All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mmnaseri.utils.tuples.Tuple Maven / Gradle / Ivy

There is a newer version: 1.1.2
Show newest version
package com.mmnaseri.utils.tuples;

import com.mmnaseri.utils.tuples.facade.HasEighth;
import com.mmnaseri.utils.tuples.facade.HasEleventh;
import com.mmnaseri.utils.tuples.facade.HasFifth;
import com.mmnaseri.utils.tuples.facade.HasFirst;
import com.mmnaseri.utils.tuples.facade.HasFourth;
import com.mmnaseri.utils.tuples.facade.HasNinth;
import com.mmnaseri.utils.tuples.facade.HasSecond;
import com.mmnaseri.utils.tuples.facade.HasSeventh;
import com.mmnaseri.utils.tuples.facade.HasSixth;
import com.mmnaseri.utils.tuples.facade.HasTenth;
import com.mmnaseri.utils.tuples.facade.HasThird;
import com.mmnaseri.utils.tuples.facade.HasTwelfth;
import com.mmnaseri.utils.tuples.impl.DefaultLabeledTuple;
import com.mmnaseri.utils.tuples.impl.EightTuple;
import com.mmnaseri.utils.tuples.impl.ElevenTuple;
import com.mmnaseri.utils.tuples.impl.EmptyTuple;
import com.mmnaseri.utils.tuples.impl.FiveTuple;
import com.mmnaseri.utils.tuples.impl.FourTuple;
import com.mmnaseri.utils.tuples.impl.NineTuple;
import com.mmnaseri.utils.tuples.impl.OneTuple;
import com.mmnaseri.utils.tuples.impl.SevenTuple;
import com.mmnaseri.utils.tuples.impl.SixTuple;
import com.mmnaseri.utils.tuples.impl.TenTuple;
import com.mmnaseri.utils.tuples.impl.ThirteenOrMoreTuple;
import com.mmnaseri.utils.tuples.impl.ThreeTuple;
import com.mmnaseri.utils.tuples.impl.TwelveTuple;
import com.mmnaseri.utils.tuples.impl.TwoTuple;
import com.mmnaseri.utils.tuples.utils.FluentList;

import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import java.util.function.IntFunction;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import java.util.stream.Stream;

import static com.mmnaseri.utils.tuples.utils.TupleUtils.checkSize;

/**
 * The base definition for a tuple.
 *
 * @author Milad Naseri ([email protected])
 */
public interface Tuple {

  /** Returns the size of the tuple. */
  int size();

  /**
   * Returns the element at the given position. Index must be between zero and the {@link #size()}
   * of this tuple.
   */
  Z get(int index);

  /** Changes the value of the element at the given index to the new value. */
  default Tuple change(int index, Z value) {
    return change(index, () -> value);
  }

  /** Changes the value of the element at the given index to the value provided by the supplier. */
  Tuple change(int index, Supplier value);

  /** Returns a new, empty tuple. This is the same as called {@link #empty()}. */
  Tuple clear();

  /** Returns a new tuple formed by dropping the element at the indicated index. */
  Tuple drop(int index);

  /** Returns a stream of all the elements in this tuple. */
  default Stream stream() {
    return IntStream.range(0, size()).boxed().map(this::get);
  }

  /** Returns the items in the tuple as an instance of {@link FluentList}. */
  FluentList asList();

  /**
   * Extends this tuple by returning a new tuple that has the provided element added to the end of
   * the elements in this tuple.
   */
  default  Tuple extend(X value) {
    return extend((Supplier) () -> value);
  }

  /**
   * Extends this tuple by returning a new tuple that has the element returned from the supplier
   * added to the end of the elements in this tuple.
   */
   Tuple extend(Supplier value);

  /** Checks the indicated element in the tuple against the provided predicate. */
  default boolean check(int index, Predicate predicate) {
    return predicate.test(get(index));
  }

  /**
   * Returns a new {@link LabeledTuple} by labeling the elements in the tuple with the corresponding
   * labels.
   */
  default LabeledTuple withLabels(String... labels) {
    return withLabels(Arrays.asList(labels));
  }

  /**
   * Returns a new {@link LabeledTuple} by labeling the elements in the tuple with the corresponding
   * labels.
   */
  default LabeledTuple withLabels(List labels) {
    return new DefaultLabeledTuple<>(this, labels);
  }

  /** Creates an array from the current tuple. */
  default Z[] asArray(IntFunction generator) {
    return stream().toArray(generator);
  }

  /** Creates an array from the current tuple. */
  default Object[] asArray() {
    return stream().toArray();
  }

  /**
   * Returns an instance of {@link EmptyTuple} that gets all of its corresponding values from this
   * tuple.
   */
  default EmptyTuple asEmpty() {
    checkSize(size(), 0);
    return of();
  }

  /**
   * Returns an instance of {@link OneTuple} that gets all of its corresponding values from this
   * tuple. This tuple must have at least 1 element.
   */
  default OneTuple asOne() {
    checkSize(size(), 1);
    return of(get(0));
  }

  /**
   * Returns an instance of {@link TwoTuple} that gets all of its corresponding values from this
   * tuple. This tuple must have at least 2 elements.
   */
  default TwoTuple asTwo() {
    checkSize(size(), 2);
    return of(get(0), get(1));
  }

  /**
   * Returns an instance of {@link ThreeTuple} that gets all of its corresponding values from this
   * tuple. This tuple must have at least 3 elements.
   */
  default ThreeTuple asThree() {
    checkSize(size(), 3);
    return of(get(0), get(1), get(2));
  }

  /**
   * Returns an instance of {@link FourTuple} that gets all of its corresponding values from this
   * tuple. This tuple must have at least 4 elements.
   */
  default FourTuple asFour() {
    checkSize(size(), 4);
    return of(get(0), get(1), get(2), get(3));
  }

  /**
   * Returns an instance of {@link FiveTuple} that gets all of its corresponding values from this
   * tuple. This tuple must have at least 5 elements.
   */
  default FiveTuple asFive() {
    checkSize(size(), 5);
    return of(get(0), get(1), get(2), get(3), get(4));
  }

  /**
   * Returns an instance of {@link SixTuple} that gets all of its corresponding values from this
   * tuple. This tuple must have at least 6 elements.
   */
  default SixTuple asSix() {
    checkSize(size(), 6);
    return of(get(0), get(1), get(2), get(3), get(4), get(5));
  }

  /**
   * Returns an instance of {@link SevenTuple} that gets all of its corresponding values from this
   * tuple. This tuple must have at least 7 elements.
   */
  default SevenTuple asSeven() {
    checkSize(size(), 7);
    return of(get(0), get(1), get(2), get(3), get(4), get(5), get(6));
  }

  /**
   * Returns an instance of {@link EightTuple} that gets all of its corresponding values from this
   * tuple. This tuple must have at least 8 elements.
   */
  default EightTuple asEight() {
    checkSize(size(), 8);
    return of(get(0), get(1), get(2), get(3), get(4), get(5), get(6), get(7));
  }

  /**
   * Returns an instance of {@link NineTuple} that gets all of its corresponding values from this
   * tuple. This tuple must have at least 9 elements.
   */
  default NineTuple asNine() {
    checkSize(size(), 9);
    return of(get(0), get(1), get(2), get(3), get(4), get(5), get(6), get(7), get(8));
  }

  /**
   * Returns an instance of {@link TenTuple} that gets all of its corresponding values from this
   * tuple. This tuple must have at least 10 elements.
   */
  default TenTuple asTen() {
    checkSize(size(), 10);
    return of(get(0), get(1), get(2), get(3), get(4), get(5), get(6), get(7), get(8), get(9));
  }

  /**
   * Returns an instance of {@link ElevenTuple} that gets all of its corresponding values from this
   * tuple. This tuple must have at least 11 elements.
   */
  default ElevenTuple asEleven() {
    checkSize(size(), 11);
    return of(
        get(0), get(1), get(2), get(3), get(4), get(5), get(6), get(7), get(8), get(9), get(10));
  }

  /**
   * Returns an instance of {@link TwelveTuple} that gets all of its corresponding values from this
   * tuple. This tuple must have at least 12 elements.
   */
  default TwelveTuple asTwelve() {
    checkSize(size(), 12);
    return of(
        get(0), get(1), get(2), get(3), get(4), get(5), get(6), get(7), get(8), get(9), get(10),
        get(11));
  }

  /**
   * Tightens the current tuple's super-type. If the tightened type is not applicable to all
   * elements, this would lead to an eventual {@link ClassCastException} when trying to access those
   * elements.
   */
  @SuppressWarnings("unchecked")
  default  Tuple tighten() {
    return (Tuple) this;
  }

  /**
   * Tightens the current tuple's super-type. If the tightened type is not applicable to all
   * elements, this would lead to an eventual {@link ClassCastException} when trying to access those
   * elements.
   */
  default  Tuple tighten(Class type) {
    return tighten();
  }

  // Static utility and builder methods.

  /**
   * Returns a function that can provided a {@link LabeledTuple} for the current tupe, with the
   * provided labels.
   *
   * @see #withLabels(String[])
   */
  static  Function, LabeledTuple> labelWith(String... labels) {
    return tuple -> tuple.withLabels(labels);
  }

  /**
   * Returns a function that can provided a {@link LabeledTuple} for the current tupe, with the
   * provided labels.
   *
   * @see #withLabels(String[])
   */
  static  Function, LabeledTuple> labelWith(List labels) {
    return tuple -> tuple.withLabels(labels);
  }

  /** Returns a new {@link EmptyTuple} from the provided values. */
  static EmptyTuple of() {
    return new EmptyTuple<>();
  }

  /** Returns a new {@link OneTuple} from the provided values. */
  static  OneTuple of(A first) {
    return new OneTuple<>(first);
  }

  /** Returns a new {@link TwoTuple} from the provided values. */
  static  TwoTuple of(A first, B second) {
    return new TwoTuple<>(first, second);
  }

  /** Returns a new {@link ThreeTuple} from the provided values. */
  static  ThreeTuple of(A first, B second, C third) {
    return new ThreeTuple<>(first, second, third);
  }

  /** Returns a new {@link FourTuple} from the provided values. */
  static  FourTuple of(A first, B second, C third, D fourth) {
    return new FourTuple<>(first, second, third, fourth);
  }

  /** Returns a new {@link FiveTuple} from the provided values. */
  static  FiveTuple of(
      A first, B second, C third, D fourth, E fifth) {
    return new FiveTuple<>(first, second, third, fourth, fifth);
  }

  /** Returns a new {@link SixTuple} from the provided values. */
  static  SixTuple of(
      A first, B second, C third, D fourth, E fifth, F sixth) {
    return new SixTuple<>(first, second, third, fourth, fifth, sixth);
  }

  /** Returns a new {@link SevenTuple} from the provided values. */
  static  SevenTuple of(
      A first, B second, C third, D fourth, E fifth, F sixth, G seventh) {
    return new SevenTuple<>(first, second, third, fourth, fifth, sixth, seventh);
  }

  /** Returns a new {@link EightTuple} from the provided values. */
  static  EightTuple of(
      A first, B second, C third, D fourth, E fifth, F sixth, G seventh, H eighth) {
    return new EightTuple<>(first, second, third, fourth, fifth, sixth, seventh, eighth);
  }

  /** Returns a new {@link NineTuple} from the provided values. */
  static  NineTuple of(
      A first, B second, C third, D fourth, E fifth, F sixth, G seventh, H eighth, I ninth) {
    return new NineTuple<>(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth);
  }

  /** Returns a new {@link TenTuple} from the provided values. */
  static  TenTuple of(
      A first,
      B second,
      C third,
      D fourth,
      E fifth,
      F sixth,
      G seventh,
      H eighth,
      I ninth,
      J tenth) {
    return new TenTuple<>(
        first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth);
  }

  /** Returns a new {@link ElevenTuple} from the provided values. */
  static  ElevenTuple of(
      A first,
      B second,
      C third,
      D fourth,
      E fifth,
      F sixth,
      G seventh,
      H eighth,
      I ninth,
      J tenth,
      K eleventh) {
    return new ElevenTuple<>(
        first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh);
  }

  /** Returns a new {@link TwelveTuple} from the provided values. */
  static 
      TwelveTuple of(
          A first,
          B second,
          C third,
          D fourth,
          E fifth,
          F sixth,
          G seventh,
          H eighth,
          I ninth,
          J tenth,
          K eleventh,
          L twelfth) {
    return new TwelveTuple<>(
        first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh,
        twelfth);
  }

  /** Returns a new {@link ThirteenOrMoreTuple} from the provided values. */
  static 
      ThirteenOrMoreTuple of(
          A first,
          B second,
          C third,
          D fourth,
          E fifth,
          F sixth,
          G seventh,
          H eighth,
          I ninth,
          J tenth,
          K eleventh,
          L twelfth,
          Object thirteenth,
          Object... rest) {
    return new ThirteenOrMoreTuple<>(
        first,
        second,
        third,
        fourth,
        fifth,
        sixth,
        seventh,
        eighth,
        ninth,
        tenth,
        eleventh,
        twelfth,
        thirteenth,
        rest);
  }

  /**
   * Returns a new {@link EmptyTuple} from the provided values.
   *
   * @see #of()
   */
  static  EmptyTuple empty() {
    return of();
  }

  /**
   * Returns a new {@link OneTuple} from the provided values.
   *
   * @see #of(Object)
   */
  static  OneTuple one(A first) {
    return of(first);
  }

  /**
   * Returns a new {@link TwoTuple} from the provided values.
   *
   * @see #of(Object, Object)
   */
  static  TwoTuple two(A first, B second) {
    return of(first, second);
  }

  /**
   * Returns a new {@link ThreeTuple} from the provided values.
   *
   * @see #of(Object, Object, Object)
   */
  static  ThreeTuple three(
      A first, B second, C third) {
    return of(first, second, third);
  }

  /**
   * Returns a new {@link FourTuple} from the provided values.
   *
   * @see #of(Object, Object, Object, Object)
   */
  static  FourTuple four(
      A first, B second, C third, D fourth) {
    return of(first, second, third, fourth);
  }

  /**
   * Returns a new {@link FiveTuple} from the provided values.
   *
   * @see #of(Object, Object, Object, Object, Object)
   */
  static  FiveTuple five(
      A first, B second, C third, D fourth, E fifth) {
    return of(first, second, third, fourth, fifth);
  }

  /**
   * Returns a new {@link SixTuple} from the provided values.
   *
   * @see #of(Object, Object, Object, Object, Object, Object)
   */
  static  SixTuple six(
      A first, B second, C third, D fourth, E fifth, F sixth) {
    return of(first, second, third, fourth, fifth, sixth);
  }

  /**
   * Returns a new {@link SevenTuple} from the provided values.
   *
   * @see #of(Object, Object, Object, Object, Object, Object, Object)
   */
  static  SevenTuple seven(
      A first, B second, C third, D fourth, E fifth, F sixth, G seventh) {
    return of(first, second, third, fourth, fifth, sixth, seventh);
  }

  /**
   * Returns a new {@link EightTuple} from the provided values.
   *
   * @see #of(Object, Object, Object, Object, Object, Object, Object, Object)
   */
  static  EightTuple eight(
      A first, B second, C third, D fourth, E fifth, F sixth, G seventh, H eighth) {
    return of(first, second, third, fourth, fifth, sixth, seventh, eighth);
  }

  /**
   * Returns a new {@link NineTuple} from the provided values.
   *
   * @see #of(Object, Object, Object, Object, Object, Object, Object, Object, Object)
   */
  static  NineTuple nine(
      A first, B second, C third, D fourth, E fifth, F sixth, G seventh, H eighth, I ninth) {
    return of(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth);
  }

  /**
   * Returns a new {@link TenTuple} from the provided values.
   *
   * @see #of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
   */
  static  TenTuple ten(
      A first,
      B second,
      C third,
      D fourth,
      E fifth,
      F sixth,
      G seventh,
      H eighth,
      I ninth,
      J tenth) {
    return of(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth);
  }

  /**
   * Returns a new {@link ElevenTuple} from the provided values.
   *
   * @see #of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object,
   *     Object)
   */
  static 
      ElevenTuple eleven(
          A first,
          B second,
          C third,
          D fourth,
          E fifth,
          F sixth,
          G seventh,
          H eighth,
          I ninth,
          J tenth,
          K eleventh) {
    return of(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh);
  }

  /**
   * Returns a new {@link TwelveTuple} from the provided values.
   *
   * @see #of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object,
   *     Object, Object)
   */
  static 
      TwelveTuple twelve(
          A first,
          B second,
          C third,
          D fourth,
          E fifth,
          F sixth,
          G seventh,
          H eighth,
          I ninth,
          J tenth,
          K eleventh,
          L twelfth) {
    return of(
        first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh,
        twelfth);
  }

  /**
   * Returns a new {@link ThirteenOrMoreTuple} from the provided values.
   *
   * @see #of(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object,
   *     Object, Object, Object, Object[])
   */
  static 
      ThirteenOrMoreTuple large(
          A first,
          B second,
          C third,
          D fourth,
          E fifth,
          F sixth,
          G seventh,
          H eighth,
          I ninth,
          J tenth,
          K eleventh,
          L twelfth,
          Object thirteenth,
          Object... rest) {
    return of(
        first,
        second,
        third,
        fourth,
        fifth,
        sixth,
        seventh,
        eighth,
        ninth,
        tenth,
        eleventh,
        twelfth,
        thirteenth,
        rest);
  }

  /**
   * Returns a function that can extend an instance of {@link EmptyTuple} into an instance of {@link
   * OneTuple} using the provided value.
   *
   * 

This is especially useful in functional contexts, for example: * *

   * oneTupleStream = emptyTupleStream.map(Tuple.extendEmpty(value));
   * 
*/ static Function, OneTuple> extendEmpty(X value) { return tuple -> tuple.extend(value); } /** * Returns a function that can extend an instance of {@link EmptyTuple} into an instance of {@link * OneTuple} using the value returned from the supplier. * *

This is especially useful in functional contexts, for example: * *

   * oneTupleStream = emptyTupleStream.map(Tuple.extendEmpty(() -> value));
   * 
*/ static Function, OneTuple> extendEmpty( Supplier supplier) { return tuple -> tuple.extend(supplier); } /** * Returns a function that can extend an instance of {@link EmptyTuple} into an instance of {@link * OneTuple} using the value returned from applying the provided function to the input tuple. * *

This is especially useful in functional contexts, for example: * *

   * oneTupleStream = emptyTupleStream.map(Tuple.extendEmpty(tuple -> tuple.get(0)));
   * 
*/ static Function, OneTuple> extendEmpty( Function, X> function) { return tuple -> tuple.extend(function); } /** * Returns a function that can extend an instance of {@link OneTuple} into an instance of {@link * TwoTuple} using the provided value. * *

This is especially useful in functional contexts, for example: * *

   * twoTupleStream = oneTupleStream.map(Tuple.extendOne(value));
   * 
*/ static Function, TwoTuple> extendOne( X value) { return tuple -> tuple.extend(value); } /** * Returns a function that can extend an instance of {@link OneTuple} into an instance of {@link * TwoTuple} using the value returned from the supplier. * *

This is especially useful in functional contexts, for example: * *

   * twoTupleStream = oneTupleStream.map(Tuple.extendOne(() -> value));
   * 
*/ static Function, TwoTuple> extendOne( Supplier supplier) { return tuple -> tuple.extend(supplier); } /** * Returns a function that can extend an instance of {@link OneTuple} into an instance of {@link * TwoTuple} using the value returned from applying the provided function to the input tuple. * *

This is especially useful in functional contexts, for example: * *

   * twoTupleStream = oneTupleStream.map(Tuple.extendOne(tuple -> tuple.get(0)));
   * 
*/ static Function, TwoTuple> extendOne( Function, X> function) { return tuple -> tuple.extend(function); } /** * Returns a function that can extend an instance of {@link TwoTuple} into an instance of {@link * ThreeTuple} using the provided value. * *

This is especially useful in functional contexts, for example: * *

   * threeTupleStream = twoTupleStream.map(Tuple.extendTwo(value));
   * 
*/ static Function, ThreeTuple> extendTwo(X value) { return tuple -> tuple.extend(value); } /** * Returns a function that can extend an instance of {@link TwoTuple} into an instance of {@link * ThreeTuple} using the value returned from the supplier. * *

This is especially useful in functional contexts, for example: * *

   * threeTupleStream = twoTupleStream.map(Tuple.extendTwo(() -> value));
   * 
*/ static Function, ThreeTuple> extendTwo(Supplier supplier) { return tuple -> tuple.extend(supplier); } /** * Returns a function that can extend an instance of {@link TwoTuple} into an instance of {@link * ThreeTuple} using the value returned from applying the provided function to the input tuple. * *

This is especially useful in functional contexts, for example: * *

   * threeTupleStream = twoTupleStream.map(Tuple.extendTwo(tuple -> tuple.get(0)));
   * 
*/ static Function, ThreeTuple> extendTwo( Function, X> function) { return tuple -> tuple.extend(function); } /** * Returns a function that can extend an instance of {@link ThreeTuple} into an instance of {@link * FourTuple} using the provided value. * *

This is especially useful in functional contexts, for example: * *

   * fourTupleStream = threeTupleStream.map(Tuple.extendThree(value));
   * 
*/ static Function, FourTuple> extendThree(X value) { return tuple -> tuple.extend(value); } /** * Returns a function that can extend an instance of {@link ThreeTuple} into an instance of {@link * FourTuple} using the value returned from the supplier. * *

This is especially useful in functional contexts, for example: * *

   * fourTupleStream = threeTupleStream.map(Tuple.extendThree(() -> value));
   * 
*/ static Function, FourTuple> extendThree(Supplier supplier) { return tuple -> tuple.extend(supplier); } /** * Returns a function that can extend an instance of {@link ThreeTuple} into an instance of {@link * FourTuple} using the value returned from applying the provided function to the input tuple. * *

This is especially useful in functional contexts, for example: * *

   * fourTupleStream = threeTupleStream.map(Tuple.extendThree(tuple -> tuple.get(0)));
   * 
*/ static Function, FourTuple> extendThree( Function, X> function) { return tuple -> tuple.extend(function); } /** * Returns a function that can extend an instance of {@link FourTuple} into an instance of {@link * FiveTuple} using the provided value. * *

This is especially useful in functional contexts, for example: * *

   * fiveTupleStream = fourTupleStream.map(Tuple.extendFour(value));
   * 
*/ static Function, FiveTuple> extendFour(X value) { return tuple -> tuple.extend(value); } /** * Returns a function that can extend an instance of {@link FourTuple} into an instance of {@link * FiveTuple} using the value returned from the supplier. * *

This is especially useful in functional contexts, for example: * *

   * fiveTupleStream = fourTupleStream.map(Tuple.extendFour(() -> value));
   * 
*/ static Function, FiveTuple> extendFour( Supplier supplier) { return tuple -> tuple.extend(supplier); } /** * Returns a function that can extend an instance of {@link FourTuple} into an instance of {@link * FiveTuple} using the value returned from applying the provided function to the input tuple. * *

This is especially useful in functional contexts, for example: * *

   * fiveTupleStream = fourTupleStream.map(Tuple.extendFour(tuple -> tuple.get(0)));
   * 
*/ static Function, FiveTuple> extendFour( Function, X> function) { return tuple -> tuple.extend(function); } /** * Returns a function that can extend an instance of {@link FiveTuple} into an instance of {@link * SixTuple} using the provided value. * *

This is especially useful in functional contexts, for example: * *

   * sixTupleStream = fiveTupleStream.map(Tuple.extendFive(value));
   * 
*/ static Function, SixTuple> extendFive(X value) { return tuple -> tuple.extend(value); } /** * Returns a function that can extend an instance of {@link FiveTuple} into an instance of {@link * SixTuple} using the value returned from the supplier. * *

This is especially useful in functional contexts, for example: * *

   * sixTupleStream = fiveTupleStream.map(Tuple.extendFive(() -> value));
   * 
*/ static Function, SixTuple> extendFive( Supplier supplier) { return tuple -> tuple.extend(supplier); } /** * Returns a function that can extend an instance of {@link FiveTuple} into an instance of {@link * SixTuple} using the value returned from applying the provided function to the input tuple. * *

This is especially useful in functional contexts, for example: * *

   * sixTupleStream = fiveTupleStream.map(Tuple.extendFive(tuple -> tuple.get(0)));
   * 
*/ static Function, SixTuple> extendFive( Function, X> function) { return tuple -> tuple.extend(function); } /** * Returns a function that can extend an instance of {@link SixTuple} into an instance of {@link * SevenTuple} using the provided value. * *

This is especially useful in functional contexts, for example: * *

   * sevenTupleStream = sixTupleStream.map(Tuple.extendSix(value));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, X extends Z> Function, SevenTuple> extendSix( X value) { return tuple -> tuple.extend(value); } /** * Returns a function that can extend an instance of {@link SixTuple} into an instance of {@link * SevenTuple} using the value returned from the supplier. * *

This is especially useful in functional contexts, for example: * *

   * sevenTupleStream = sixTupleStream.map(Tuple.extendSix(() -> value));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, X extends Z> Function, SevenTuple> extendSix( Supplier supplier) { return tuple -> tuple.extend(supplier); } /** * Returns a function that can extend an instance of {@link SixTuple} into an instance of {@link * SevenTuple} using the value returned from applying the provided function to the input tuple. * *

This is especially useful in functional contexts, for example: * *

   * sevenTupleStream = sixTupleStream.map(Tuple.extendSix(tuple -> tuple.get(0)));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, X extends Z> Function, SevenTuple> extendSix( Function, X> function) { return tuple -> tuple.extend(function); } /** * Returns a function that can extend an instance of {@link SevenTuple} into an instance of {@link * EightTuple} using the provided value. * *

This is especially useful in functional contexts, for example: * *

   * eightTupleStream = sevenTupleStream.map(Tuple.extendSeven(value));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, X extends Z> Function, EightTuple> extendSeven(X value) { return tuple -> tuple.extend(value); } /** * Returns a function that can extend an instance of {@link SevenTuple} into an instance of {@link * EightTuple} using the value returned from the supplier. * *

This is especially useful in functional contexts, for example: * *

   * eightTupleStream = sevenTupleStream.map(Tuple.extendSeven(() -> value));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, X extends Z> Function, EightTuple> extendSeven(Supplier supplier) { return tuple -> tuple.extend(supplier); } /** * Returns a function that can extend an instance of {@link SevenTuple} into an instance of {@link * EightTuple} using the value returned from applying the provided function to the input tuple. * *

This is especially useful in functional contexts, for example: * *

   * eightTupleStream = sevenTupleStream.map(Tuple.extendSeven(tuple -> tuple.get(0)));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, X extends Z> Function, EightTuple> extendSeven(Function, X> function) { return tuple -> tuple.extend(function); } /** * Returns a function that can extend an instance of {@link EightTuple} into an instance of {@link * NineTuple} using the provided value. * *

This is especially useful in functional contexts, for example: * *

   * nineTupleStream = eightTupleStream.map(Tuple.extendEight(value));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, H extends Z, X extends Z> Function, NineTuple> extendEight(X value) { return tuple -> tuple.extend(value); } /** * Returns a function that can extend an instance of {@link EightTuple} into an instance of {@link * NineTuple} using the value returned from the supplier. * *

This is especially useful in functional contexts, for example: * *

   * nineTupleStream = eightTupleStream.map(Tuple.extendEight(() -> value));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, H extends Z, X extends Z> Function, NineTuple> extendEight(Supplier supplier) { return tuple -> tuple.extend(supplier); } /** * Returns a function that can extend an instance of {@link EightTuple} into an instance of {@link * NineTuple} using the value returned from applying the provided function to the input tuple. * *

This is especially useful in functional contexts, for example: * *

   * nineTupleStream = eightTupleStream.map(Tuple.extendEight(tuple -> tuple.get(0)));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, H extends Z, X extends Z> Function, NineTuple> extendEight(Function, X> function) { return tuple -> tuple.extend(function); } /** * Returns a function that can extend an instance of {@link NineTuple} into an instance of {@link * TenTuple} using the provided value. * *

This is especially useful in functional contexts, for example: * *

   * tenTupleStream = nineTupleStream.map(Tuple.extendNine(value));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, H extends Z, I extends Z, X extends Z> Function, TenTuple> extendNine(X value) { return tuple -> tuple.extend(value); } /** * Returns a function that can extend an instance of {@link NineTuple} into an instance of {@link * TenTuple} using the value returned from the supplier. * *

This is especially useful in functional contexts, for example: * *

   * tenTupleStream = nineTupleStream.map(Tuple.extendNine(() -> value));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, H extends Z, I extends Z, X extends Z> Function, TenTuple> extendNine(Supplier supplier) { return tuple -> tuple.extend(supplier); } /** * Returns a function that can extend an instance of {@link NineTuple} into an instance of {@link * TenTuple} using the value returned from applying the provided function to the input tuple. * *

This is especially useful in functional contexts, for example: * *

   * tenTupleStream = nineTupleStream.map(Tuple.extendNine(tuple -> tuple.get(0)));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, H extends Z, I extends Z, X extends Z> Function, TenTuple> extendNine(Function, X> function) { return tuple -> tuple.extend(function); } /** * Returns a function that can extend an instance of {@link TenTuple} into an instance of {@link * ElevenTuple} using the provided value. * *

This is especially useful in functional contexts, for example: * *

   * elevenTupleStream = tenTupleStream.map(Tuple.extendTen(value));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, H extends Z, I extends Z, J extends Z, X extends Z> Function< TenTuple, ElevenTuple> extendTen(X value) { return tuple -> tuple.extend(value); } /** * Returns a function that can extend an instance of {@link TenTuple} into an instance of {@link * ElevenTuple} using the value returned from the supplier. * *

This is especially useful in functional contexts, for example: * *

   * elevenTupleStream = tenTupleStream.map(Tuple.extendTen(() -> value));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, H extends Z, I extends Z, J extends Z, X extends Z> Function< TenTuple, ElevenTuple> extendTen(Supplier supplier) { return tuple -> tuple.extend(supplier); } /** * Returns a function that can extend an instance of {@link TenTuple} into an instance of {@link * ElevenTuple} using the value returned from applying the provided function to the input tuple. * *

This is especially useful in functional contexts, for example: * *

   * elevenTupleStream = tenTupleStream.map(Tuple.extendTen(tuple -> tuple.get(0)));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, H extends Z, I extends Z, J extends Z, X extends Z> Function< TenTuple, ElevenTuple> extendTen(Function, X> function) { return tuple -> tuple.extend(function); } /** * Returns a function that can extend an instance of {@link ElevenTuple} into an instance of * {@link TwelveTuple} using the provided value. * *

This is especially useful in functional contexts, for example: * *

   * twelveTupleStream = elevenTupleStream.map(Tuple.extendEleven(value));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, H extends Z, I extends Z, J extends Z, K extends Z, X extends Z> Function< ElevenTuple, TwelveTuple> extendEleven(X value) { return tuple -> tuple.extend(value); } /** * Returns a function that can extend an instance of {@link ElevenTuple} into an instance of * {@link TwelveTuple} using the value returned from the supplier. * *

This is especially useful in functional contexts, for example: * *

   * twelveTupleStream = elevenTupleStream.map(Tuple.extendEleven(() -> value));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, H extends Z, I extends Z, J extends Z, K extends Z, X extends Z> Function< ElevenTuple, TwelveTuple> extendEleven(Supplier supplier) { return tuple -> tuple.extend(supplier); } /** * Returns a function that can extend an instance of {@link ElevenTuple} into an instance of * {@link TwelveTuple} using the value returned from applying the provided function to the input * tuple. * *

This is especially useful in functional contexts, for example: * *

   * twelveTupleStream = elevenTupleStream.map(Tuple.extendEleven(tuple -> tuple.get(0)));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, H extends Z, I extends Z, J extends Z, K extends Z, X extends Z> Function< ElevenTuple, TwelveTuple> extendEleven(Function, X> function) { return tuple -> tuple.extend(function); } /** * Returns a function that can extend an instance of {@link TwelveTuple} into an instance of * {@link ThirteenOrMoreTuple} using the provided value. * *

This is especially useful in functional contexts, for example: * *

   * thirteenOrMoreTupleStream = twelveTupleStream.map(Tuple.extendTwelve(value));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, H extends Z, I extends Z, J extends Z, K extends Z, L extends Z, X extends Z> Function< TwelveTuple, ThirteenOrMoreTuple> extendTwelve(X value) { return tuple -> tuple.extend(value); } /** * Returns a function that can extend an instance of {@link TwelveTuple} into an instance of * {@link ThirteenOrMoreTuple} using the value returned from the supplier. * *

This is especially useful in functional contexts, for example: * *

   * thirteenOrMoreTupleStream = twelveTupleStream.map(Tuple.extendTwelve(() -> value));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, H extends Z, I extends Z, J extends Z, K extends Z, L extends Z, X extends Z> Function< TwelveTuple, ThirteenOrMoreTuple> extendTwelve(Supplier supplier) { return tuple -> tuple.extend(supplier); } /** * Returns a function that can extend an instance of {@link TwelveTuple} into an instance of * {@link ThirteenOrMoreTuple} using the value returned from applying the provided function to the * input tuple. * *

This is especially useful in functional contexts, for example: * *

   * thirteenOrMoreTupleStream = twelveTupleStream.map(Tuple.extendTwelve(tuple -> tuple.get(0)));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, H extends Z, I extends Z, J extends Z, K extends Z, L extends Z, X extends Z> Function< TwelveTuple, ThirteenOrMoreTuple> extendTwelve(Function, X> function) { return tuple -> tuple.extend(function); } /** * Returns a function that can extend an instance of {@link ThirteenOrMoreTuple} into another * instance of {@link ThirteenOrMoreTuple} using the provided value. * *

This is especially useful in functional contexts, for example: * *

   * stream1 = stream2.map(Tuple.extendLarge(value));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, H extends Z, I extends Z, J extends Z, K extends Z, L extends Z, X extends Z> Function< ThirteenOrMoreTuple, ThirteenOrMoreTuple> extendLarge(X value) { return tuple -> tuple.extend(value); } /** * Returns a function that can extend an instance of {@link ThirteenOrMoreTuple} into another * instance of {@link ThirteenOrMoreTuple} using the value returned from the supplier. * *

This is especially useful in functional contexts, for example: * *

   * stream1 = stream2.map(Tuple.extendLarge(() -> value));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, H extends Z, I extends Z, J extends Z, K extends Z, L extends Z, X extends Z> Function< ThirteenOrMoreTuple, ThirteenOrMoreTuple> extendLarge(Supplier supplier) { return tuple -> tuple.extend(supplier); } /** * Returns a function that can extend an instance of {@link ThirteenOrMoreTuple} into another * instance of {@link ThirteenOrMoreTuple} using the value returned from applying the provided * function to the input tuple. * *

This is especially useful in functional contexts, for example: * *

   * stream1 = stream2.map(Tuple.extendLarge(tuple -> tuple.get(0)));
   * 
*/ static < Z, A extends Z, B extends Z, C extends Z, D extends Z, E extends Z, F extends Z, G extends Z, H extends Z, I extends Z, J extends Z, K extends Z, L extends Z, X extends Z> Function< ThirteenOrMoreTuple, ThirteenOrMoreTuple> extendLarge( Function, X> function) { return tuple -> tuple.extend(function); } /** * Returns a function that can map the first element of the tuple into the provided value. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasFirst#first(Object)}: * *

   * stream.map(tuple -> tuple.first(value))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasFirst> Function mapFirst(X value) { return tuple -> (U) tuple.first(value); } /** * Returns a function that can map the first element of the tuple into the value returned from the * supplier. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasFirst#first(Supplier)}: * *

   * stream.map(tuple -> tuple.first(supplier))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasFirst> Function mapFirst(Supplier supplier) { return tuple -> (U) tuple.first(supplier); } /** * Returns a function that can map the first element of the tuple into the value returned after * applying the provided function to the input tuple. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasFirst#first(Function)}: * *

   * stream.map(tuple -> tuple.first(function))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasFirst> Function mapFirst(Function function) { return tuple -> (U) tuple.first(function); } /** * Returns a function that can map the second element of the tuple into the provided value. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasSecond#second(Object)}: * *

   * stream.map(tuple -> tuple.second(value))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasSecond> Function mapSecond(X value) { return tuple -> (U) tuple.second(value); } /** * Returns a function that can map the second element of the tuple into the value returned from * the supplier. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasSecond#second(Supplier)}: * *

   * stream.map(tuple -> tuple.second(supplier))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasSecond> Function mapSecond(Supplier supplier) { return tuple -> (U) tuple.second(supplier); } /** * Returns a function that can map the second element of the tuple into the value returned after * applying the provided function to the input tuple. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasSecond#second(Function)}: * *

   * stream.map(tuple -> tuple.second(function))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasSecond> Function mapSecond(Function function) { return tuple -> (U) tuple.second(function); } /** * Returns a function that can map the third element of the tuple into the provided value. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasThird#third(Object)}: * *

   * stream.map(tuple -> tuple.third(value))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasThird> Function mapThird(X value) { return tuple -> (U) tuple.third(value); } /** * Returns a function that can map the third element of the tuple into the value returned from the * supplier. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasThird#third(Supplier)}: * *

   * stream.map(tuple -> tuple.third(supplier))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasThird> Function mapThird(Supplier supplier) { return tuple -> (U) tuple.third(supplier); } /** * Returns a function that can map the third element of the tuple into the value returned after * applying the provided function to the input tuple. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasThird#third(Function)}: * *

   * stream.map(tuple -> tuple.third(function))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasThird> Function mapThird(Function function) { return tuple -> (U) tuple.third(function); } /** * Returns a function that can map the fourth element of the tuple into the provided value. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasFourth#fourth(Object)}: * *

   * stream.map(tuple -> tuple.fourth(value))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasFourth> Function mapFourth(X value) { return tuple -> (U) tuple.fourth(value); } /** * Returns a function that can map the fourth element of the tuple into the value returned from * the supplier. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasFourth#fourth(Supplier)}: * *

   * stream.map(tuple -> tuple.fourth(supplier))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasFourth> Function mapFourth(Supplier supplier) { return tuple -> (U) tuple.fourth(supplier); } /** * Returns a function that can map the fourth element of the tuple into the value returned after * applying the provided function to the input tuple. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasFourth#fourth(Function)}: * *

   * stream.map(tuple -> tuple.fourth(function))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasFourth> Function mapFourth(Function function) { return tuple -> (U) tuple.fourth(function); } /** * Returns a function that can map the fifth element of the tuple into the provided value. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasFifth#fifth(Object)}: * *

   * stream.map(tuple -> tuple.fifth(value))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasFifth> Function mapFifth(X value) { return tuple -> (U) tuple.fifth(value); } /** * Returns a function that can map the fifth element of the tuple into the value returned from the * supplier. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasFifth#fifth(Supplier)}: * *

   * stream.map(tuple -> tuple.fifth(supplier))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasFifth> Function mapFifth(Supplier supplier) { return tuple -> (U) tuple.fifth(supplier); } /** * Returns a function that can map the fifth element of the tuple into the value returned after * applying the provided function to the input tuple. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasFifth#fifth(Function)}: * *

   * stream.map(tuple -> tuple.fifth(function))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasFifth> Function mapFifth(Function function) { return tuple -> (U) tuple.fifth(function); } /** * Returns a function that can map the sixth element of the tuple into the provided value. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasSixth#sixth(Object)}: * *

   * stream.map(tuple -> tuple.sixth(value))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasSixth> Function mapSixth(X value) { return tuple -> (U) tuple.sixth(value); } /** * Returns a function that can map the sixth element of the tuple into the value returned from the * supplier. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasSixth#sixth(Supplier)}: * *

   * stream.map(tuple -> tuple.sixth(supplier))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasSixth> Function mapSixth(Supplier supplier) { return tuple -> (U) tuple.sixth(supplier); } /** * Returns a function that can map the sixth element of the tuple into the value returned after * applying the provided function to the input tuple. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasSixth#sixth(Function)}: * *

   * stream.map(tuple -> tuple.sixth(function))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasSixth> Function mapSixth(Function function) { return tuple -> (U) tuple.sixth(function); } /** * Returns a function that can map the seventh element of the tuple into the provided value. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasSeventh#seventh(Object)}: * *

   * stream.map(tuple -> tuple.seventh(value))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasSeventh> Function mapSeventh(X value) { return tuple -> (U) tuple.seventh(value); } /** * Returns a function that can map the seventh element of the tuple into the value returned from * the supplier. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasSeventh#seventh(Supplier)}: * *

   * stream.map(tuple -> tuple.seventh(supplier))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasSeventh> Function mapSeventh(Supplier supplier) { return tuple -> (U) tuple.seventh(supplier); } /** * Returns a function that can map the seventh element of the tuple into the value returned after * applying the provided function to the input tuple. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasSeventh#seventh(Function)}: * *

   * stream.map(tuple -> tuple.seventh(function))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasSeventh> Function mapSeventh(Function function) { return tuple -> (U) tuple.seventh(function); } /** * Returns a function that can map the eighth element of the tuple into the provided value. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasEighth#eighth(Object)}: * *

   * stream.map(tuple -> tuple.eighth(value))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasEighth> Function mapEighth(X value) { return tuple -> (U) tuple.eighth(value); } /** * Returns a function that can map the eighth element of the tuple into the value returned from * the supplier. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasEighth#eighth(Supplier)}: * *

   * stream.map(tuple -> tuple.eighth(supplier))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasEighth> Function mapEighth(Supplier supplier) { return tuple -> (U) tuple.eighth(supplier); } /** * Returns a function that can map the eighth element of the tuple into the value returned after * applying the provided function to the input tuple. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasEighth#eighth(Function)}: * *

   * stream.map(tuple -> tuple.eighth(function))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasEighth> Function mapEighth(Function function) { return tuple -> (U) tuple.eighth(function); } /** * Returns a function that can map the ninth element of the tuple into the provided value. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasNinth#ninth(Object)}: * *

   * stream.map(tuple -> tuple.ninth(value))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasNinth> Function mapNinth(X value) { return tuple -> (U) tuple.ninth(value); } /** * Returns a function that can map the ninth element of the tuple into the value returned from the * supplier. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasNinth#ninth(Supplier)}: * *

   * stream.map(tuple -> tuple.ninth(supplier))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasNinth> Function mapNinth(Supplier supplier) { return tuple -> (U) tuple.ninth(supplier); } /** * Returns a function that can map the ninth element of the tuple into the value returned after * applying the provided function to the input tuple. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasNinth#ninth(Function)}: * *

   * stream.map(tuple -> tuple.ninth(function))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasNinth> Function mapNinth(Function function) { return tuple -> (U) tuple.ninth(function); } /** * Returns a function that can map the tenth element of the tuple into the provided value. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasTenth#tenth(Object)}: * *

   * stream.map(tuple -> tuple.tenth(value))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasTenth> Function mapTenth(X value) { return tuple -> (U) tuple.tenth(value); } /** * Returns a function that can map the tenth element of the tuple into the value returned from the * supplier. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasTenth#tenth(Supplier)}: * *

   * stream.map(tuple -> tuple.tenth(supplier))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasTenth> Function mapTenth(Supplier supplier) { return tuple -> (U) tuple.tenth(supplier); } /** * Returns a function that can map the tenth element of the tuple into the value returned after * applying the provided function to the input tuple. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasTenth#tenth(Function)}: * *

   * stream.map(tuple -> tuple.tenth(function))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasTenth> Function mapTenth(Function function) { return tuple -> (U) tuple.tenth(function); } /** * Returns a function that can map the eleventh element of the tuple into the provided value. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasEleventh#eleventh(Object)}: * *

   * stream.map(tuple -> tuple.eleventh(value))
   * 
*/ @SuppressWarnings("unchecked") static < Z, A extends Z, X extends Z, T extends HasEleventh, U extends HasEleventh> Function mapEleventh(X value) { return tuple -> (U) tuple.eleventh(value); } /** * Returns a function that can map the eleventh element of the tuple into the value returned from * the supplier. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasEleventh#eleventh(Supplier)}: * *

   * stream.map(tuple -> tuple.eleventh(supplier))
   * 
*/ @SuppressWarnings("unchecked") static < Z, A extends Z, X extends Z, T extends HasEleventh, U extends HasEleventh> Function mapEleventh(Supplier supplier) { return tuple -> (U) tuple.eleventh(supplier); } /** * Returns a function that can map the eleventh element of the tuple into the value returned after * applying the provided function to the input tuple. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasEleventh#eleventh(Function)}: * *

   * stream.map(tuple -> tuple.eleventh(function))
   * 
*/ @SuppressWarnings("unchecked") static < Z, A extends Z, X extends Z, T extends HasEleventh, U extends HasEleventh> Function mapEleventh(Function function) { return tuple -> (U) tuple.eleventh(function); } /** * Returns a function that can map the twelfth element of the tuple into the provided value. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasTwelfth#twelfth(Object)}: * *

   * stream.map(tuple -> tuple.twelfth(value))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasTwelfth> Function mapTwelfth(X value) { return tuple -> (U) tuple.twelfth(value); } /** * Returns a function that can map the twelfth element of the tuple into the value returned from * the supplier. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasTwelfth#twelfth(Supplier)}: * *

   * stream.map(tuple -> tuple.twelfth(supplier))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasTwelfth> Function mapTwelfth(Supplier supplier) { return tuple -> (U) tuple.twelfth(supplier); } /** * Returns a function that can map the twelfth element of the tuple into the value returned after * applying the provided function to the input tuple. * *

NB: This method erases the type signature of the input tuple. If you need * to preserve the type signatures, please use {@link HasTwelfth#twelfth(Function)}: * *

   * stream.map(tuple -> tuple.twelfth(function))
   * 
*/ @SuppressWarnings("unchecked") static , U extends HasTwelfth> Function mapTwelfth(Function function) { return tuple -> (U) tuple.twelfth(function); } /** * Returns a function that can map the {@code nth} element of the tuple into the provided value. */ static Function, Tuple> mapNth(int index, A value) { return tuple -> tuple.change(index, value); } /** * Returns a function that can map the {@code nth} element of the tuple into the value returned * from the supplier. */ static Function, Tuple> mapNth(int index, Supplier supplier) { return tuple -> tuple.change(index, supplier); } /** * Returns a predicate that can check the input tuple's first element against the provided * predicate. */ static , A extends Z> Predicate> checkFirst( Predicate predicate) { return tuple -> tuple.checkFirst(predicate); } /** * Returns a predicate that can check the input tuple's second element against the provided * predicate. */ static , A extends Z> Predicate> checkSecond( Predicate predicate) { return tuple -> tuple.checkSecond(predicate); } /** * Returns a predicate that can check the input tuple's third element against the provided * predicate. */ static , A extends Z> Predicate> checkThird( Predicate predicate) { return tuple -> tuple.checkThird(predicate); } /** * Returns a predicate that can check the input tuple's fourth element against the provided * predicate. */ static , A extends Z> Predicate> checkFourth( Predicate predicate) { return tuple -> tuple.checkFourth(predicate); } /** * Returns a predicate that can check the input tuple's fifth element against the provided * predicate. */ static , A extends Z> Predicate> checkFifth( Predicate predicate) { return tuple -> tuple.checkFifth(predicate); } /** * Returns a predicate that can check the input tuple's sixth element against the provided * predicate. */ static , A extends Z> Predicate> checkSixth( Predicate predicate) { return tuple -> tuple.checkSixth(predicate); } /** * Returns a predicate that can check the input tuple's seventh element against the provided * predicate. */ static , A extends Z> Predicate> checkSeventh(Predicate predicate) { return tuple -> tuple.checkSeventh(predicate); } /** * Returns a predicate that can check the input tuple's eighth element against the provided * predicate. */ static , A extends Z> Predicate> checkEighth( Predicate predicate) { return tuple -> tuple.checkEighth(predicate); } /** * Returns a predicate that can check the input tuple's ninth element against the provided * predicate. */ static , A extends Z> Predicate> checkNinth( Predicate predicate) { return tuple -> tuple.checkNinth(predicate); } /** * Returns a predicate that can check the input tuple's tenth element against the provided * predicate. */ static , A extends Z> Predicate> checkTenth( Predicate predicate) { return tuple -> tuple.checkTenth(predicate); } /** * Returns a predicate that can check the input tuple's eleventh element against the provided * predicate. */ static , A extends Z> Predicate> checkEleventh(Predicate predicate) { return tuple -> tuple.checkEleventh(predicate); } /** * Returns a predicate that can check the input tuple's twelfth element against the provided * predicate. */ static , A extends Z> Predicate> checkTwelfth(Predicate predicate) { return tuple -> tuple.checkTwelfth(predicate); } /** * Returns a predicate that can check the input tuple's {@code nth} element against the provided * predicate. */ static Predicate> checkNth(int index, Predicate predicate) { return tuple -> tuple.check(index, predicate); } }