Class Tuple<K,V>

java.lang.Object
org.deltava.util.Tuple<K,V>
Type Parameters:
K - the first value type
V - the second value type
All Implemented Interfaces:
Serializable, Comparable<Tuple<K,?>>, Cacheable

public class Tuple<K,V> extends Object implements Cacheable, Comparable<Tuple<K,?>>
A utility class to create a tuple.
Since:
6.0
Version:
12.4
Author:
Luke
See Also:
  • Constructor Details

    • Tuple

      protected Tuple(K k, V v)
      Constructor.
      Parameters:
      k - the first value
      v - the second value
  • Method Details

    • getLeft

      public K getLeft()
      Returns the first value.
      Returns:
      the value
    • getRight

      public V getRight()
      Returns the second value.
      Returns:
      the value
    • isPopulated

      public boolean isPopulated()
      Returns whether both values are populated.
      Returns:
      TRUE if both are non-null, otherwise FALSE
    • create

      public static final <K,V> Tuple<K,V> create(K k, V v)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

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

      public Object cacheKey()
      Description copied from interface: Cacheable
      Returns the cache key for this object. Caches call this method when adding the object.
      Specified by:
      cacheKey in interface Cacheable
      Returns:
      the cache key for the object
    • compareTo

      public int compareTo(Tuple<K,?> t2)
      Specified by:
      compareTo in interface Comparable<K>