title: Android ArrayList iterator returns null
body: <p>I have a simple code below, where an <a href="http://developer.android.com/reference/java/util/ArrayList.html" rel="nofollow">ArrayList</a> iterator returns null when I am looping around the list. Does anyone have an idea what can cause the iterator to return null? Unfortunately i don't have the actual data, as this does happen only on other phones, I have no idea what is in allDisplayNames, but i know the list is initialized, as I check that it doesn't equal null.
  Thanks in advance!</p>
  
  <p>Here is the code:</p>
  
  <pre><code>            HashMap&lt;Integer, List&lt;String&gt;&gt; allDisplayNames = Contact
                      .getAllFullnames();
              ...
              for (Contact contact : Application.getContacts().values()) {
                  ...
                  ArrayList&lt;String&gt; namechunks = new ArrayList&lt;String&gt;();
                  List&lt;String&gt; displaynames = new ArrayList&lt;String&gt;();
                  displaynames.add(contact.getDisplay_name());
                  if (allDisplayNames.get(contact.getId()) != null) {
                      displaynames.addAll(allDisplayNames.get(contact.getId()));
                  }
                  for (String string : displaynames) {
                      if (string==null) {
                          continue;
                      }
                      String[] temp = string.split(" "); &lt;-- this line used to trigger NullPointer
                      ...
                  }
  </code></pre>