Class Tuple1<V1>

java.lang.Object
io.permazen.tuple.Tuple1<V1>
Type Parameters:
V1 - value type
All Implemented Interfaces:
Has1<V1>, Tuple

public class Tuple1<V1> extends Object
A "tuple" of one value.

Instances are immutable.

  • Constructor Details

    • Tuple1

      public Tuple1(V1 v1)
      Constructor.
      Parameters:
      v1 - the value
  • Method Details

    • 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
    • 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
    • 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
    • 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
      Overrides:
      hashCode in class Object