Interface Tuple<X>

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

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

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default X[] asArray​(java.lang.Class<X> cls)
      Copy the elements of this Tuple into a newly created array
      default java.util.List<X> asList()
      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​(java.util.function.Consumer<? super X> action)
      forEach
      X get​(int i)
      Get the i'th element, for i in the range 0 to len()-1
      default boolean isEmpty()
      Return true if this is a zero-length tuple
      default java.util.Iterator<X> iterator()
      Iterable
      int len()
      length : elements are 0 to len()-1
      <Y> Tuple<Y> map​(java.util.function.Function<X,​Y> function)
      Map to a new tuple.
      default java.util.stream.Stream<X> stream()
      stream
      • Methods inherited from interface java.lang.Iterable

        spliterator
    • Method Detail

      • get

        X get​(int i)
        Get the i'th element, for i in the range 0 to len()-1
        Throws:
        java.lang.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 java.util.List<X> asList()
        Convert to a List
      • contains

        boolean contains​(X item)
        forEach
      • stream

        default java.util.stream.Stream<X> stream()
        stream
      • forEach

        default void forEach​(java.util.function.Consumer<? super X> action)
        forEach
        Specified by:
        forEach in interface java.lang.Iterable<X>
      • map

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

        default java.util.Iterator<X> iterator()
        Iterable
        Specified by:
        iterator in interface java.lang.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​(java.lang.Class<X> cls)
        Copy the elements of this Tuple into a newly created array