/** * Returns the {@link Set} of {@link AddeEntry} addresses stored in this {@code EntryStore}. * * @return {@code Set} containing all of the stored addresses. If no addresses are stored, an * empty {@code Set} is returned. */ public Set<String> getAddresses() { Set<String> addresses = newLinkedHashSet(trie.size()); for (AddeEntry entry : trie.values()) { addresses.add(entry.getAddress()); } return addresses; }
/** * Returns the {@link Set} of {@link AddeEntry#getGroup()}s that match the given {@code address} * and {@code type}. * * @param address ADDE server address whose groups are needed. Cannot be {@code null}. * @param type Only include groups that match {@link EntryType}. Cannot be {@code null}. * @return Either a set containing the desired groups, or an empty set if there were no matches. */ public Set<String> getGroupsFor(final String address, EntryType type) { notNull(address); notNull(type); Set<String> groups = newLinkedHashSet(trie.size()); for (AddeEntry entry : trie.getPrefixedBy(address + '!').values()) { if (entry.getAddress().equals(address) && entry.getEntryType() == type) { groups.add(entry.getGroup()); } } return groups; }