Interface Tuple<X>

All Superinterfaces:
Iterable<X>
All Known Implementing Classes:
Tuple0, Tuple1, Tuple2, Tuple3, Tuple4, Tuple5, Tuple6, Tuple7, Tuple8, TupleN

public interface Tuple<X> extends Iterable<X>
A Tuple is a sequence of items of the same class of item. Tuples are immutable. .equals is "by value".
  • Method Summary

    Modifier and Type
    Method
    Description
    default X[]
    asArray(Class<X> cls)
    Copy the elements of this Tuple into a newly created array
    default List<X>
    Convert to a List
    boolean
    contains(X item)
    forEach
    default void
    copyInto(X[] array)
    Copy the elements of this Tuple into the array
    default void
    copyInto(X[] array, int start)
    Copy the elements of this Tuple start at 'start' into the array
    default void
    copyInto(X[] array, int start, int length)
    Copy the elements of this Tuple into the array
    default void
    forEach(Consumer<? super X> action)
    forEach
    get(int i)
    Get the i'th element, for i in the range 0 to len()-1
    default boolean
    Return true if this is a zero-length tuple
    default Iterator<X>
    Iterable
    int
    len()
    length : elements are 0 to len()-1
    <Y> Tuple<Y>
    map(Function<X,Y> function)
    Map to a new tuple.
    default Stream<X>
    stream

    Methods inherited from interface java.lang.Iterable

    spliterator
  • Method Details

    • get

      X get(int i)
      Get the i'th element, for i in the range 0 to len()-1
      Throws:
      IndexOutOfBoundsException - for i out of range
    • len

      int len()
      length : elements are 0 to len()-1
    • isEmpty

      default boolean isEmpty()
      Return true if this is a zero-length tuple
    • asList

      default List<X> asList()
      Convert to a List
    • contains

      boolean contains(X item)
      forEach
    • stream

      default Stream<X> stream()
      stream
    • forEach

      default void forEach(Consumer<? super X> action)
      forEach
      Specified by:
      forEach in interface Iterable<X>
    • map

      <Y> Tuple<Y> map(Function<X,Y> function)
      Map to a new tuple.
    • iterator

      default Iterator<X> iterator()
      Iterable
      Specified by:
      iterator in interface Iterable<X>
    • copyInto

      default void copyInto(X[] array)
      Copy the elements of this Tuple into the array
    • copyInto

      default void copyInto(X[] array, int start)
      Copy the elements of this Tuple start at 'start' into the array
    • copyInto

      default void copyInto(X[] array, int start, int length)
      Copy the elements of this Tuple into the array
    • asArray

      default X[] asArray(Class<X> cls)
      Copy the elements of this Tuple into a newly created array