SmallTagMap implements Iterable<Tag> { @Override public Iterator<Tag> iterator() { return new SmallTagIterator(); } SmallTagMap(Tag[] tagArray); static Builder builder(); @Override Iterator<Tag> iterator(); Tag get(String key); @Override int hashCode(); @Override String toString(); boolean containsKey(String k); boolean isEmpty(); int size(); @Deprecated Set<Tag> tagSet(); @Override /** {@inheritDoc} */ boolean equals(Object obj); static final int MAX_TAGS; static final int INITIAL_TAG_SIZE; }
@Test public void testIterator() { final Tag t1 = Tags.newTag("k1", "v"); final Tag t2 = Tags.newTag("k2", "v2"); SmallTagMap map = SmallTagMap.builder().add(t1).add(t2).result(); Set<Tag> tags = UnmodifiableSet.copyOf(map.iterator()); assertEquals(tags, UnmodifiableSet.of(t1, t2)); }