Package org.apache.commons.collections4
Interface Trie<K,V>
-
- Type Parameters:
K- the type of the keys in this mapV- the type of the values in this map
- All Superinterfaces:
Get<K,V>,IterableGet<K,V>,IterableMap<K,V>,IterableSortedMap<K,V>,java.util.Map<K,V>,OrderedMap<K,V>,Put<K,V>,java.util.SortedMap<K,V>
- All Known Implementing Classes:
AbstractBitwiseTrie,PatriciaTrie,UnmodifiableTrie
public interface Trie<K,V> extends IterableSortedMap<K,V>
Defines the interface for a prefix tree, an ordered tree data structure. For more information, see Tries.- Since:
- 4.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.SortedMap<K,V>prefixMap(K key)Returns a view of thisTrieof all elements that are prefixed by the given key.-
Methods inherited from interface org.apache.commons.collections4.Get
containsKey, containsValue, entrySet, get, isEmpty, keySet, remove, size, values
-
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
-
Methods inherited from interface org.apache.commons.collections4.OrderedMap
firstKey, lastKey, mapIterator, nextKey, previousKey
-
-
-
-
Method Detail
-
prefixMap
java.util.SortedMap<K,V> prefixMap(K key)
Returns a view of thisTrieof all elements that are prefixed by the given key.In a
Triewith fixed size keys, this is essentially aMap.get(Object)operation.For example, if the
Triecontains 'Anna', 'Anael', 'Analu', 'Andreas', 'Andrea', 'Andres', and 'Anatole', then a lookup of 'And' would return 'Andreas', 'Andrea', and 'Andres'.- Parameters:
key- the key used in the search- Returns:
- a
SortedMapview of thisTriewith all elements whose key is prefixed by the search key
-
-