Class Tuple<K,V>

java.lang.Object
org.apache.directory.api.ldap.model.cursor.Tuple<K,V>
Type Parameters:
K - The key type for the Tuple
V - The associated Value type

public class Tuple<K,V> extends Object
A key/value tuple for simple two column persistent Tables with sorted keys.
Author:
Apache Directory Project
  • Constructor Details

    • Tuple

      public Tuple()
      Do nothing default that has a null key and null value.
    • Tuple

      public Tuple(K key, V value)
      Creates a Tuple using a key and a value.
      Parameters:
      key - the key to set
      value - the value to set
  • Method Details

    • getKey

      public K getKey()
      Gets the key for this Tuple.
      Returns:
      the Tuple's key
    • setKey

      public Tuple<K,V> setKey(K key)
      Sets the key for this Tuple.
      Parameters:
      key - the new key to set
      Returns:
      this Tuple itself to set and return
    • getValue

      public V getValue()
      Gets the value for this Tuple.
      Returns:
      the Tuple's value
    • setValue

      public Tuple<K,V> setValue(V value)
      Sets the value for this Tuple.
      Parameters:
      value - the new value to set
      Returns:
      this Tuple itself to set and return
    • setBoth

      public Tuple<K,V> setBoth(K key, V value)
      Sets both the key and the value for this Tuple in one call and returns this Tuple object. This is useful for setting the tuples key and value then returning it.
      Parameters:
      key - the new key to set
      value - the new value to set
      Returns:
      this Tuple itself to set and return
    • setBoth

      public Tuple<K,V> setBoth(Tuple<K,V> tupleToCopy)
      Sets both the key and the value for this Tuple in one call and returns this Tuple object. This is useful for setting the tuples key and value then returning it.
      Parameters:
      tupleToCopy - the tuple to copy
      Returns:
      this Tuple itself to set and return
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object