Class Triple<L,M,R>

java.lang.Object
com.landawn.abacus.util.Triple<L,M,R>
Type Parameters:
L -
M -
R -
All Implemented Interfaces:
Mutable

public final class Triple<L,M,R> extends Object implements Mutable
Since:
0.8
Author:
Haiyang Li
  • Field Details

    • left

      public L left
    • middle

      public M middle
  • Constructor Details

    • Triple

      public Triple()
  • Method Details

    • of

      public static <L, M, R> Triple<L,M,R> of(L l, M m, R r)
      Type Parameters:
      L -
      M -
      R -
      Parameters:
      l -
      m -
      r -
      Returns:
    • emptyArray

      public static <L, M, R> Triple<L,M,R>[] emptyArray()
      Type Parameters:
      L -
      M -
      R -
      Returns:
    • getLeft

      public L getLeft()
      Gets the left.
      Returns:
    • setLeft

      public void setLeft(L left)
      Sets the left.
      Parameters:
      left - the new left
    • getMiddle

      public M getMiddle()
      Gets the middle.
      Returns:
    • setMiddle

      public void setMiddle(M middle)
      Sets the middle.
      Parameters:
      middle - the new middle
    • getRight

      public R getRight()
      Gets the right.
      Returns:
    • setRight

      public void setRight(R right)
      Sets the right.
      Parameters:
      right - the new right
    • set

      public void set(L left, M middle, R right)
      Parameters:
      left -
      middle -
      right -
    • getAndSetLeft

      public L getAndSetLeft(L newLeft)
      Gets the and set left.
      Parameters:
      newLeft -
      Returns:
    • setAndGetLeft

      public L setAndGetLeft(L newLeft)
      Sets the and get left.
      Parameters:
      newLeft -
      Returns:
    • getAndSetMiddle

      public M getAndSetMiddle(M newMiddle)
      Gets the and set middle.
      Parameters:
      newMiddle -
      Returns:
    • setAndGetMiddle

      public M setAndGetMiddle(M newMiddle)
      Sets the and get middle.
      Parameters:
      newMiddle -
      Returns:
    • getAndSetRight

      public R getAndSetRight(R newRight)
      Gets the and set right.
      Parameters:
      newRight -
      Returns:
    • setAndGetRight

      public R setAndGetRight(R newRight)
      Sets the and get right.
      Parameters:
      newRight -
      Returns:
    • setLeftIf

      public <E extends Exception> boolean setLeftIf(L newLeft, Throwables.BiPredicate<? super Triple<L,M,R>,? super L,E> predicate) throws E
      Set to the specified newLeft and returns true if predicate returns true. Otherwise returns false without setting the value to new value.
      Type Parameters:
      E -
      Parameters:
      newLeft -
      predicate - - the first parameter is current pair, the second parameter is the newLeft
      Returns:
      Throws:
      E - the e
    • setMiddleIf

      public <E extends Exception> boolean setMiddleIf(M newMiddle, Throwables.BiPredicate<? super Triple<L,M,R>,? super M,E> predicate) throws E
      Set to the specified newMiddle and returns true if predicate returns true. Otherwise returns false without setting the value to new value.
      Type Parameters:
      E -
      Parameters:
      newMiddle -
      predicate - - the first parameter is current pair, the second parameter is the newMiddle
      Returns:
      Throws:
      E - the e
    • setRightIf

      public <E extends Exception> boolean setRightIf(R newRight, Throwables.BiPredicate<? super Triple<L,M,R>,? super R,E> predicate) throws E
      Set to the specified newRight and returns true if predicate returns true. Otherwise returns false without setting the value to new value.
      Type Parameters:
      E -
      Parameters:
      newRight -
      predicate - - the first parameter is current pair, the second parameter is the newRight
      Returns:
      Throws:
      E - the e
    • setIf

      public <E extends Exception> boolean setIf(L newLeft, M newMiddle, R newRight, Throwables.QuadPredicate<? super Triple<L,M,R>,? super L,? super M,? super R,E> predicate) throws E
      Set to the specified newLeft and newRight and returns true if predicate returns true. Otherwise returns false without setting the left/right to new values.
      Type Parameters:
      E -
      Parameters:
      newLeft -
      newMiddle -
      newRight -
      predicate - - the first parameter is current pair, the second parameter is the newLeft, the third parameter is the newMiddle, the fourth parameter is the newRight
      Returns:
      Throws:
      E - the e
    • reverse

      @Beta public Triple<R,M,L> reverse()
      Returns a new instance of Triple<R, M, L>.
      Returns:
      a new instance of Triple<R, M, L>.
    • copy

      public Triple<L,M,R> copy()
      Returns:
    • toArray

      public Object[] toArray()
      Returns:
    • toArray

      public <A> A[] toArray(A[] a)
      Type Parameters:
      A -
      Parameters:
      a -
      Returns:
    • forEach

      public <E extends Exception> void forEach(Throwables.Consumer<?,E> comsumer) throws E
      Type Parameters:
      E -
      Parameters:
      comsumer -
      Throws:
      E - the e
    • accept

      public <E extends Exception> void accept(Throwables.TriConsumer<? super L,? super M,? super R,E> action) throws E
      Type Parameters:
      E -
      Parameters:
      action -
      Throws:
      E - the e
    • accept

      public <E extends Exception> void accept(Throwables.Consumer<? super Triple<L,M,R>,E> action) throws E
      Type Parameters:
      E -
      Parameters:
      action -
      Throws:
      E - the e
    • map

      public <U, E extends Exception> U map(Throwables.TriFunction<? super L,? super M,? super R,U,E> mapper) throws E
      Type Parameters:
      U -
      E -
      Parameters:
      mapper -
      Returns:
      Throws:
      E - the e
    • map

      public <U, E extends Exception> U map(Throwables.Function<? super Triple<L,M,R>,U,E> mapper) throws E
      Type Parameters:
      U -
      E -
      Parameters:
      mapper -
      Returns:
      Throws:
      E - the e
    • filter

      public <E extends Exception> u.Optional<Triple<L,M,R>> filter(Throwables.TriPredicate<? super L,? super M,? super R,E> predicate) throws E
      Type Parameters:
      E -
      Parameters:
      predicate -
      Returns:
      Throws:
      E - the e
    • filter

      public <E extends Exception> u.Optional<Triple<L,M,R>> filter(Throwables.Predicate<? super Triple<L,M,R>,E> predicate) throws E
      Type Parameters:
      E -
      Parameters:
      predicate -
      Returns:
      Throws:
      E - the e
    • stream

      public Stream<Triple<L,M,R>> stream()
      Returns:
    • stream

      public <T, E extends Exception> Stream<T> stream(Throwables.Function<? super Triple<L,M,R>,Stream<T>,E> func) throws E
      Type Parameters:
      T -
      E -
      Parameters:
      func -
      Returns:
      Throws:
      E
    • toOptional

      public u.Optional<Triple<L,M,R>> toOptional()
      Returns:
    • toTuple

      public Tuple.Tuple3<L,M,R> toTuple()
      Returns:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      Returns:
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
      Parameters:
      obj -
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns: