How are the iterators of an HashSet
ordered?
Suppose I got these:
HashSet<E> set = new HashSet<E>();
Iterator<E> it=set.iterator();
Does it.next()
return elements in a certain order? And how does it works actually?
How are the iterators of an HashSet
ordered?
Suppose I got these:
HashSet<E> set = new HashSet<E>();
Iterator<E> it=set.iterator();
Does it.next()
return elements in a certain order? And how does it works actually?
From the Javadoc:
Returns an iterator over the elements in this set. The elements are returned in no particular order.
Also, some SO posts: