java - arraylist check if element exits here ignore the case
<p>Hi i have the arraylist it stores the string values. I want to check the some string is exists in the list or not. Here i want ignore the case sensitive. </p>

<p><strong>code</strong></p>

<pre><code>public static ArrayList&lt; String &gt; arrFoodItems = new ArrayList&lt; String &gt;();

if(arrFoodItems.contains("string"))

        {
            System.out.println("already available in the List.");
        }
        else
        {
            System.out.println("Not available");
        }   
</code></pre>

<p>It's working fine. But in the following example it fails. How to do it without using loops.
Example: List contains: "Rice, Chicken,..."
Now you are check for "rice" is exits in the list. In this case we are getting "not exists".</p>

<p><strong>Don't using this</strong></p>

<pre><code>for(int i=0; i &lt; arrFoodItems.size(); i++)
{

   if(arrFoodItems.get(i)..equalsIgnoreCase(string))
   {
        System.out.println("already available in the List.");
   }
}
</code></pre>
