Class Tuple3<V1,V2,V3>

java.lang.Object
io.permazen.tuple.Tuple3<V1,V2,V3>
Type Parameters:
V1 - first value type
V2 - second value type
V3 - third value type
All Implemented Interfaces:
Has1<V1>, Has2<V1,V2>, Has3<V1,V2,V3>, Tuple

public class Tuple3<V1,V2,V3> extends Object
A tuple of three values.

Instances are immutable.

  • Constructor Details

    • Tuple3

      public Tuple3(V1 v1, V2 v2, V3 v3)
      Constructor.
      Parameters:
      v1 - the first value
      v2 - the second value
      v3 - the third value
  • Method Details

    • getValue3

      public V3 getValue3()
      Description copied from interface: Has3
      Get the third value.
      Specified by:
      getValue3 in interface Has3<V1,V2,V3>
      Returns:
      third value in this tuple
    • getSize

      public int getSize()
      Description copied from interface: Tuple
      Get the number of values in this tuple.
      Specified by:
      getSize in interface Tuple
      Returns:
      the size of this tuple
    • asList

      public List<Object> asList()
      Description copied from interface: Tuple
      View this instance as a list.
      Specified by:
      asList in interface Tuple
      Returns:
      unmodifiable List view of this tuple
    • hashCode

      public int hashCode()
      Description copied from interface: Tuple
      Compute hash code.

      The hash code of a tuple is the exclusive-OR of the hash codes of the individual values (using zero for null values).

      Specified by:
      hashCode in interface Tuple
    • getValue2

      public V2 getValue2()
      Description copied from interface: Has2
      Get the second value.
      Specified by:
      getValue2 in interface Has2<V1,V2>
      Returns:
      second value in this tuple
    • getValue1

      public V1 getValue1()
      Description copied from interface: Has1
      Get the first value.
      Specified by:
      getValue1 in interface Has1<V1>
      Returns:
      first value in this tuple
    • toString

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

      public boolean equals(Object obj)
      Description copied from interface: Tuple
      Compare for equality.

      Tuples are equal if they have the same size and the corresponding individual values are equal (or null).

      Specified by:
      equals in interface Tuple
      Overrides:
      equals in class Object