title: How to check element is not null in java
body: <pre><code>filterItems = null;
  filterItems = new ArrayList&lt;SelectItem&gt;();
  
  
  Iterator&lt;String&gt; it = RefListMap.keySet().iterator();
          while (it.hasNext()) {
              String s = (String) it.next();
              filterItems.add(new SelectItem(s, s));
          }
  </code></pre>
  
  <p>Now i am getting filterItems size=1 but that value is null.How to check array element is not equal to null.</p>
  
  <pre><code>if(filterItems != null)
  {
  
   code
  }
  </code></pre>
  
  <p>but this condition is not working...Please help me.</p>