title: Java/Groovy How do I correctly compare two string values? .equals() not working
body: <p>Ok, this is driving me nuts.
  I'm not too savvy with Java/Groovy but please point me to the right direction!</p>
  
  <p>I have a GET call with response text like "["a","b","c"]"</p>
  
  <p>I finally got it to arraylist to iterate through to compare strings.
  I tried .equals(), .equalsIgnoreCase(), compareTo(), Objects.equals() etc. It does not match. I get "String not the same".
  What am I missing?</p>
  
  <pre><code>def sb= new StringBuffer();
  def rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
  
  def line;
  while((line=rd.readLine()) !=null) {
      sb.append(line);
  }
  
  //sb = "["a","b","c"]"
  
  List&lt;String&gt; tempList = new ArrayList&lt;String&gt;(Arrays.asList(sb.replaceAll("\\[|\\]","").split(",")));
  int count = 0;
  String strToFind= "a";
  
  for (String iT : tempList){
      if (strToFind.equals(iT)){
          log.debug("\nString the same\n");
      } else {
          log.debug("\nString not the same\n");
      }
  }
  </code></pre>