title: How to iterate through ArrayList derived from object
body: <p>Newbie to Java and Android...</p>
  
  <p>I am using a class to store a group of Google Map LatLng points to iterate through.  Here is the class I am using to assign an Arraylist to an Object:</p>
  
  <pre><code>public class GeoPoints implements Iterable&lt;String&gt;, Iterator&lt;String&gt; {
  
  private HashMap&lt;String, Object&gt; internalStorage = new HashMap&lt;String, Object&gt;();
  
  
  private int count = 0;
  
  public void add(String key, Object value) {
      internalStorage.put(key, value);
  }
  
  public Object get(String key) {
      return internalStorage.get(key);
  }
  
  @Override
  public boolean hasNext() {
      if (count &lt;  internalStorage.size()) {
          return true;
      }
      return false;
  }
  
  @Override
  public String next() {
      if (count == internalStorage.size()) throw new IndexOutOfBoundsException();
  
      count++;
  
      return (String) internalStorage.keySet().toArray()[count - 1];
  }
  
  @Override
  public void remove() {
      throw new UnsupportedOperationException();
  }
  
  @Override
  public Iterator&lt;String&gt; iterator() {
      return this;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I am placing the points like this:</p>
  
  <pre><code>geoPoints = new GeoPoints();
  
  
  
      // Load GeoPoints ArrayList...
      List&lt;LatLng&gt; points = new ArrayList&lt;LatLng&gt;();
  
      points.add(new LatLng(45.778754, -124.811288));
      points.add(new LatLng(28.781740, -124.350814));
      points.add(new LatLng(48.712660, -60.982386));
      points.add(new LatLng(20.354554, -58.794457));
  
  
      geoPoints.add("US_MAP", points);
  </code></pre>
  
  <p>To access the object I am using a for loop as follows:</p>
  
  <pre><code>for (String key : geoPoints ) {
  
      Object obj = geoPoints.get(key);
  
  }
  </code></pre>
  
  <p>At this point, I can debug and see that the Object obj contains the ArrayList I created with the four points above.</p>
  
  <p>For the life of me I cannot figure out how to access these Arraylist values in order to Iterate or loop through the values.</p>
  
  <p>I have tried assigning the obj to an arraylist iterator as such:</p>
  
  <pre><code>ArrayList&lt;?&gt; myTestItr = geoPoints.get(key);
  </code></pre>
  
  <p>Which does not work, I am sure for obvious reasons... :)</p>
  
  <p>I am sure there is a simple answer to this (using a Iterator  wildcard, etc) but I am coming up short.</p>
  
  <p>Any and all help is greatly appreciated!</p>
  
  <p>Thanks in advance!</p>