title: Java ArrayList Contains() method not working
body: <p>I have no doubt that the contains() method is working correctly but apparently I am doing something wrong. I am working on an android app and I am detecting WiFi and listing the WiFi in a listView. I am attempting to filter out duplicate occurrences of the same Access Point so I am creating an array to keep track of duplicates. Here is my code:</p>
  
  <pre><code>public void getWifi(){
  
      ListView wifiList = (ListView)findViewById(R.id.listView);
  
      WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
      List&lt;ScanResult&gt; apList = wifiManager.getScanResults();
      wifiManager.startScan();
  
      List&lt;String&gt; wifees = new ArrayList&lt;&gt;();
  
      //split info into arrays
      for(int i=0; i &lt; apList.size(); i++){
  
          String[] daList = String.valueOf(apList.get(i)).split(",");
  
          String info = "";
          List&lt;String&gt; SSIDs = new ArrayList&lt;&gt;();
  
          for (String listItem : daList) {
              String topic = String.valueOf(listItem.split(":")[0]);
              String val = listItem.split(":")[1];
              Log.d(TAG, topic);
              if (Objects.equals(topic, "SSID")) {
                  if(SSIDs.contains(val)){
                      Log.d(TAG, "CONTAINS");
                      break;
                  } else {
                      SSIDs.add(val);
                      info = val;
                  }
              } else if (Objects.equals(topic, " level")){
                  String strength = "";
                  if (Integer.parseInt(val.substring(1)) &gt;= -35) {
                      strength = "100%";
                  } else if (Integer.parseInt(val.substring(1)) &lt;= -35 &amp;&amp; Integer.parseInt(val.substring(1)) &gt;= -65) {
                      strength = "50%";
                  } else {
                      strength = "1%";
                  }
                  info += "   " + strength;
              }
          }
          wifees.add(info);
      }
  
      assert wifiList != null;
      ArrayAdapter apter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, wifees);
      wifiList.setAdapter(apter);
  }
  </code></pre>
  
  <p>This is the contents of an apList item or what I get when I call apList.get(i):</p>
  
  <pre><code>SSID: SCHOOL-GUEST, BSSID: 04:04:04:04:04:04, capabilities: [ESS], level: -91, frequency: 2412, timestamp: 72500687089, distance: ?(cm), distanceSd: ?(cm), passpoint: no, ChannelBandwidth: 0, centerFreq0: 0, centerFreq1: 0, 80211mcResponder: is not supported
  </code></pre>
  
  <p>Here is the output of that code(roughly because it is on a phone and I would rather not include the AP names for security reasons):</p>
  
  <pre><code>SCHOOL-WIRELESS        100%
  SCHOOL-SECURE        50%
  SCHOOL-GUEST        50%
  SCHOOL WIRELESS        1%
  SCHOOL_WIRELESS        1%
  SCHOOL-SECURE        1%
  SCHOOL-GUEST        1%
  bxz1872         50%
  ...
  ...
  ...
  (so on and so forth)
  </code></pre>
  
  <p>If I could just get a second opinion that would be great. I feel like I am missing something obvious. Thanks!</p>