SmallTagMap implements Iterable<Tag> { public Tag get(String key) { int idx = binarySearch(tagArray, key); if (idx < 0) { return null; } else { return tagArray[idx]; } } 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 testGet() { Tag tag = Tags.newTag("k1", "v1"); SmallTagMap map = SmallTagMap.builder().add(tag).result(); assertEquals(map.get("k1"), tag); assertNull(map.get("k2")); }