org.apache.commons.collections4

## Interface Trie<K,V>

- All Superinterfaces:
    Get<K,V>, IterableGet<K,V>, IterableMap<K,V>, IterableSortedMap<K,V>, Map<K,V>, OrderedMap<K,V>, Put<K,V>, 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
  Version:
    $Id: Trie.java 1543279 2013-11-19 00:54:31Z ggregory $

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface java.util.Map

      `Map.Entry<K,V>`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `SortedMap<K,V>` | `prefixMap(K key)` Returns a view of this `Trie` of all elements that are prefixed by the given key.

    - ### Methods inherited from interface java.util.SortedMap

      `comparator, entrySet, firstKey, headMap, keySet, lastKey, subMap, tailMap, values`

    - ### Methods inherited from interface org.apache.commons.collections4.OrderedMap

      `firstKey, lastKey, mapIterator, nextKey, previousKey`

    - ### Methods inherited from interface java.util.Map

      `clear, containsKey, containsValue, equals, get, hashCode, isEmpty, put, putAll, remove, size`

    - ### Methods inherited from interface org.apache.commons.collections4.Put

      `clear, put, putAll`

    - ### Methods inherited from interface org.apache.commons.collections4.Get

      `containsKey, containsValue, entrySet, get, isEmpty, keySet, remove, size, values`

- - ### Method Detail

    - #### prefixMap

          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 `Map.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` - the key used in the search
      Returns:
        a `SortedMap` view of this `Trie` with all elements whose key is prefixed by the search key

Copyright © 2001–2013 The Apache Software Foundation. All rights reserved.