title: Comparing string against arraylist
body: <p>I have an arrayList which I need to compare against String.</p>
  
  <p>What I have done:</p>
  
  <pre><code>ArrayList&lt;String&gt; val = new ArrayList&lt;String&gt;();
  val= getValues();
  </code></pre>
  
  <p>If I print val , it gives me expected values.But</p>
  
  <pre><code>if(val.contains("abcd"))
  </code></pre>
  
  <p>It is returning false although at time of printing values of val it consists of abcd.</p>
  
  <p>What can possibly be wrong?</p>
  
  <p>Edited:
  How my arraylist is getting values:</p>
  
  <pre><code>IOUtils.copy(inputStream , write)
  str = write.toString()
  
  ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
  list.addAll(Arrays.asList(str));
  return list;
  </code></pre>