Trie extends AbstractMap<String, V> { @Override public void putAll(Map<? extends String, ? extends V> map) { for (var entry : map.entrySet()) { put(entry.getKey(), entry.getValue()); } } 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 putAll() { trie.putAll(Map.of("key1", "value1", "key2", "value2")); assertEquals(2, trie.size()); assertEquals(2, trie.modifications); assertEquals("value1", trie.get("key1")); assertEquals("value2", trie.get("key2")); }