@Test public void iterator() { final HashSet<Integer> tested = new HashSet<>(); final Set<Integer> set = new java.util.HashSet<>(); for (int i = 0; i < 10000; ++i) { tested.add(i); set.add(i); } for (Integer key : tested) { Assert.assertTrue(set.remove(key)); } Assert.assertEquals(0, set.size()); }
@Override public @NotNull Iterator<E> iterator() { return new HashSetIterator<E>() { @Override public E next() { return nextEntry().key; } }; }
HashSet extends AbstractSet<E> { @Override public @NotNull Iterator<E> iterator() { return new HashSetIterator<E>() { @Override public E next() { return nextEntry().key; } }; } }
HashSet extends AbstractSet<E> { @Override public @NotNull Iterator<E> iterator() { return new HashSetIterator<E>() { @Override public E next() { return nextEntry().key; } }; } HashSet();  HashSet(int capacity);  HashSet(int capacity, float loadFactor);  HashSet(final Collection<E> collection); }
HashSet extends AbstractSet<E> { @Override public @NotNull Iterator<E> iterator() { return new HashSetIterator<E>() { @Override public E next() { return nextEntry().key; } }; } HashSet();  HashSet(int capacity);  HashSet(int capacity, float loadFactor);  HashSet(final Collection<E> collection); @Override boolean contains(Object key); @Override boolean add(E key); @Override boolean remove(Object key); @Override @NotNull Iterator<E> iterator(); @Override int size(); }
HashSet extends AbstractSet<E> { @Override public @NotNull Iterator<E> iterator() { return new HashSetIterator<E>() { @Override public E next() { return nextEntry().key; } }; } HashSet();  HashSet(int capacity);  HashSet(int capacity, float loadFactor);  HashSet(final Collection<E> collection); @Override boolean contains(Object key); @Override boolean add(E key); @Override boolean remove(Object key); @Override @NotNull Iterator<E> iterator(); @Override int size();  }