Interface Triple<T1,T2,T3>

Type Parameters:
T1 - The type of the first value
T2 - The type of the second value
T3 - The type of the third value
All Superinterfaces:
ViewableAsTriple<T1,T2,T3>

public interface Triple<T1,T2,T3> extends ViewableAsTriple<T1,T2,T3>
A triple is a simple composition of three arbitrary values (objects). A triple captures no semantics of the three values, and they are only referred to as "the first", "the second", and "the third" value.
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
    static <T1, T2, T3> Triple<T1,T2,T3>
    flatten(Tuple<Tuple<T1,T2>,T3> nestedTuple)
     
    <S1, S2, S3> Triple<S1,S2,S3>
    map(Function<? super T1,? extends S1> firstMapper, Function<? super T2,? extends S2> secondMapper, Function<? super T3,? extends S3> thirdMapper)
    Create a new triple by applying a function to each element, and putting the results into a new triple.
    <S1> Triple<S1,T2,T3>
    mapFirst(Function<? super T1,? extends S1> mapper)
    Create a new triple by applying a function to the first element, and putting the result as the first element of the new triple.
    <S2> Triple<T1,S2,T3>
    mapSecond(Function<? super T2,? extends S2> mapper)
    Create a new triple by applying a function to the second element, and putting the result as the second element of the new triple.
    <S3> Triple<T1,T2,S3>
    mapThird(Function<? super T3,? extends S3> mapper)
    Create a new triple by applying a function to the third element, and putting the result as the third element of the new triple.
    static <T1, T2, T3> Triple<T1,T2,T3>
    of(T1 first, T2 second, T3 third)
     
     
     
    <R> R
    to(TriFunction<? super T1,? super T2,? super T3,R> convertor)
    Convert this triple to an instance of an arbitrary type.
  • Method Details

    • of

      static <T1, T2, T3> Triple<T1,T2,T3> of(T1 first, T2 second, T3 third)
    • flatten

      static <T1, T2, T3> Triple<T1,T2,T3> flatten(Tuple<Tuple<T1,T2>,T3> nestedTuple)
    • first

      T1 first()
      Returns:
      the first value
    • second

      T2 second()
      Returns:
      the second value
    • third

      T3 third()
      Returns:
      the third value
    • mapFirst

      <S1> Triple<S1,T2,T3> mapFirst(Function<? super T1,? extends S1> mapper)
      Create a new triple by applying a function to the first element, and putting the result as the first element of the new triple.
      Parameters:
      mapper - the function to apply to the first element
      Returns:
      the new triple
    • mapSecond

      <S2> Triple<T1,S2,T3> mapSecond(Function<? super T2,? extends S2> mapper)
      Create a new triple by applying a function to the second element, and putting the result as the second element of the new triple.
      Parameters:
      mapper - the function to apply to the second element
      Returns:
      the new triple
    • mapThird

      <S3> Triple<T1,T2,S3> mapThird(Function<? super T3,? extends S3> mapper)
      Create a new triple by applying a function to the third element, and putting the result as the third element of the new triple.
      Parameters:
      mapper - the function to apply to the third element
      Returns:
      the new triple
    • map

      <S1, S2, S3> Triple<S1,S2,S3> map(Function<? super T1,? extends S1> firstMapper, Function<? super T2,? extends S2> secondMapper, Function<? super T3,? extends S3> thirdMapper)
      Create a new triple by applying a function to each element, and putting the results into a new triple.
      Parameters:
      firstMapper - the function to apply to the first element
      secondMapper - the function to apply to the second element
      thirdMapper - the function to apply to the third element
      Returns:
      the new triple
    • asTriple

      Triple<T1,T2,T3> asTriple()
      Specified by:
      asTriple in interface ViewableAsTriple<T1,T2,T3>
      Returns:
      this triple instance
    • to

      <R> R to(TriFunction<? super T1,? super T2,? super T3,R> convertor)
      Convert this triple to an instance of an arbitrary type.
      Type Parameters:
      R - The type of the resulting instance
      Parameters:
      convertor - the function used to convert the contained values to a resulting compound instance.
      Returns:
      the result from the given function