Trie extends AbstractMap<String, V> { <C extends Collection<T>, T> C prefixed(String prefix, Function<Entry<String, V>, T> mapper, C collection) { var entry = root; for (var character : prefix.toCharArray()) { entry = entry.child(character); if (entry == null) { return collection; } } map(entry, mapper, collection); return collection; } Trie(); Set<Entry<String, V>> prefixEntries(String prefix); Set<String> prefixedKeys(String prefix); Collection<V> prefixedValues(String prefix); @Override boolean containsValue(Object value); @Override boolean containsKey(Object key); @Override @Nullable V get(Object key); @Override void putAll(Map<? extends String, ? extends V> map); @Override @Nullable V put(String key, V value); @Override @Nullable V remove(Object key); @Override void clear(); @Override int size(); @Override boolean isEmpty(); @Override Set<Entry<String, V>> entrySet(); @Override Set<String> keySet(); @Override Collection<V> values();  }
@Test void prefixed() { populated.put("applyingÜee", "value"); assertEquals(1, populated.prefixed("applyin", entry -> entry, new ArrayList<>()).size()); }