title: Check if a String is in an ArrayList of Strings
body: <p>How can I check if a <code>String</code> is there in the <code>List</code>?</p>
  
  <p>I want to assign <code>1</code> to <code>temp</code> if there is a result, <code>2</code> otherwise.</p>
  
  <p>My current code is:</p>
  
  <pre><code>Integer temp = 0;
  List&lt;String&gt; bankAccNos = new ArrayList&lt;String&gt;();//assume list contains values
  String bankAccNo = "abc";
  for(String no : bankAccNos)
      if(no.equals(bankAccNo))
          temp = 1;
  </code></pre>