Top Description Methods
org.apache.commons.collections4

public Interface Trie<K, V>

extends IterableSortedMap<K, V>
Known Direct Implementers
org.apache.commons.collections4.trie.AbstractBitwiseTrie, org.apache.commons.collections4.trie.UnmodifiableTrie
Type Parameters
<K>
the type of the keys in this map
<V>
the type of the values in this map
Imports
java.util.SortedMap

Defines the interface for a prefix tree, an ordered tree data structure. For more information, see Tries.
Since
4.0

Method Summary

Modifier and TypeMethod and Description
public SortedMap<K, V>

Returns:

a SortedMap view of this Trie with all elements whose key is prefixed by the search key
prefixMap
(K
the key used in the search
key
)

Returns a view of this Trie of all elements that are prefixed by the given key.

Method Detail

prefixMapback to summary
public SortedMap<K, V> prefixMap(K key)

Returns a view of this Trie of all elements that are prefixed by the given key.

In a Trie with fixed size keys, this is essentially a get(Object) operation.

For example, if the Trie contains 'Anna', 'Anael', 'Analu', 'Andreas', 'Andrea', 'Andres', and 'Anatole', then a lookup of 'And' would return 'Andreas', 'Andrea', and 'Andres'.

Parameters
key:K

the key used in the search

Returns:SortedMap<K, V>

a SortedMap view of this Trie with all elements whose key is prefixed by the search key