Package org.apache.commons.collections4.trie

# Class AbstractPatriciaTrie.TrieEntry<K,V>

java.lang.Object
org.apache.commons.collections4.trie.AbstractPatriciaTrie.TrieEntry<K,V>

Type Parameters:
  `K` - the key type.
  `V` - the value type.

All Implemented Interfaces:
  `Serializable`, `Map.Entry<K,V>`

Enclosing class:
  `AbstractPatriciaTrie<K,V>`

protected static class AbstractPatriciaTrie.TrieEntry<K,V> extends Object
A `Trie` is a set of `AbstractPatriciaTrie.TrieEntry` nodes.

See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected int`
  `bitIndex`
  The index this entry is comparing.
  `protected K`
  `key`
  The entry's key.
  `protected AbstractPatriciaTrie.TrieEntry<K,V>`
  `left`
  The left child of this entry.
  `protected AbstractPatriciaTrie.TrieEntry<K,V>`
  `parent`
  The parent of this entry.
  `protected AbstractPatriciaTrie.TrieEntry<K,V>`
  `predecessor`
  The entry who uplinks to this entry.
  `protected AbstractPatriciaTrie.TrieEntry<K,V>`
  `right`
  The right child of this entry.
  `protected V`
  `value`
  The entry's value.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TrieEntry(K key, V value, int bitIndex)`
  Constructs a new instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object o)`
  `K`
  `getKey()`
  `V`
  `getValue()`
  `int`
  `hashCode()`
  `boolean`
  `isEmpty()`
  Whether the entry is storing a key.
  `boolean`
  `isExternalNode()`
  Whether the left or right child is a loopback.
  `boolean`
  `isInternalNode()`
  Tests that neither the left nor right child is a loopback.
  `V`
  `setKeyValue(K key, V value)`
  Replaces the current key and value with the provided key & value.
  `V`
  `setValue(V value)`
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### bitIndex

    protected int bitIndex
    The index this entry is comparing.

  - ### parent

    protected AbstractPatriciaTrie.TrieEntry<K,V> parent
    The parent of this entry.

  - ### left

    protected AbstractPatriciaTrie.TrieEntry<K,V> left
    The left child of this entry.

  - ### right

    protected AbstractPatriciaTrie.TrieEntry<K,V> right
    The right child of this entry.

  - ### predecessor

    protected AbstractPatriciaTrie.TrieEntry<K,V> predecessor
    The entry who uplinks to this entry.

  - ### key

    protected K key
    The entry's key.

  - ### value

    protected V value
    The entry's value.

- ## Constructor Details

  - ### TrieEntry

    public TrieEntry(K key, V value, int bitIndex)
    Constructs a new instance.
    Parameters:
      `key` - The entry's key.
      `value` - The entry's value.
      `bitIndex` - The entry's bitIndex.

- ## Method Details

  - ### isEmpty

    public boolean isEmpty()
    Whether the entry is storing a key. Only the root can potentially be empty, all other nodes must have a key.
    Returns:
      Whether the entry is storing a key

  - ### isExternalNode

    public boolean isExternalNode()
    Whether the left or right child is a loopback.
    Returns:
      Whether the left or right child is a loopback.

  - ### isInternalNode

    public boolean isInternalNode()
    Tests that neither the left nor right child is a loopback.
    Returns:
      That neither the left nor right child is a loopback.

  - ### toString

    public String toString()

  - ### equals

    public boolean equals(Object o)
    Specified by:
      `equals` in interface `Map.Entry<K,V>`
    Overrides:
      `equals` in class `Object`

  - ### getKey

    public K getKey()
    Specified by:
      `getKey` in interface `Map.Entry<K,V>`

  - ### getValue

    public V getValue()
    Specified by:
      `getValue` in interface `Map.Entry<K,V>`

  - ### hashCode

    public int hashCode()
    Specified by:
      `hashCode` in interface `Map.Entry<K,V>`
    Overrides:
      `hashCode` in class `Object`

  - ### setKeyValue

    public V setKeyValue(K key, V value)
    Replaces the current key and value with the provided key & value.
    Parameters:
      `key` - The new key.
      `value` - The new value.
    Returns:
      The previous value.

  - ### setValue

    public V setValue(V value)
    Specified by:
      `setValue` in interface `Map.Entry<K,V>`