Untitled


SUBMITTED BY: Guest

DATE: Nov. 22, 2014, 3:45 p.m.

FORMAT: Java

SIZE: 337 Bytes

HITS: 1058

  1. Collection<Integer> key1 = accounts.keySet(); //accounts = A hashmap with integer,integer
  2. Iterator<Integer> iter = key1.iterator(); //Create the iterator
  3. while (iter.hasNext())//Check if there is more to go to
  4. {
  5. iter.next(); //This is the object you get from the iterator, it also advances the iterator by one
  6. }

comments powered by Disqus