Package com.landawn.abacus.util
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
- Since:
- 0.8
- Author:
- Haiyang Li
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<E extends Exception>
void<E extends Exception>
voidaccept
(Throwables.TriConsumer<? super L, ? super M, ? super R, E> action) copy()
static <L,
M, R> Triple<L, M, R>[] boolean
filter
(Throwables.TriPredicate<? super L, ? super M, ? super R, E> predicate) <E extends Exception>
voidforEach
(Throwables.Consumer<?, E> comsumer) getAndSetLeft
(L newLeft) Gets the and set left.getAndSetMiddle
(M newMiddle) Gets the and set middle.getAndSetRight
(R newRight) Gets the and set right.getLeft()
Gets the left.Gets the middle.getRight()
Gets the right.int
hashCode()
<U,
E extends Exception>
U<U,
E extends Exception>
Umap
(Throwables.TriFunction<? super L, ? super M, ? super R, U, E> mapper) static <L,
M, R> Triple<L, M, R> of
(L l, M m, R r) reverse()
Returns a new instance of Triple<R, M, L>.void
setAndGetLeft
(L newLeft) Sets the and get left.setAndGetMiddle
(M newMiddle) Sets the and get middle.setAndGetRight
(R newRight) Sets the and get right.<E extends Exception>
booleansetIf
(L newLeft, M newMiddle, R newRight, Throwables.QuadPredicate<? super Triple<L, M, R>, ? super L, ? super M, ? super R, E> predicate) Set to the specifiednewLeft
andnewRight
and returnstrue
ifpredicate
returns true.void
Sets the left.<E extends Exception>
booleanSet to the specifiednewLeft
and returnstrue
ifpredicate
returns true.void
Sets the middle.<E extends Exception>
booleansetMiddleIf
(M newMiddle, Throwables.BiPredicate<? super Triple<L, M, R>, ? super M, E> predicate) Set to the specifiednewMiddle
and returnstrue
ifpredicate
returns true.void
Sets the right.<E extends Exception>
booleansetRightIf
(R newRight, Throwables.BiPredicate<? super Triple<L, M, R>, ? super R, E> predicate) Set to the specifiednewRight
and returnstrue
ifpredicate
returns true.stream()
Object[]
toArray()
<A> A[]
toArray
(A[] a) u.Optional<Triple<L,
M, R>> toString()
Tuple.Tuple3<L,
M, R> toTuple()
-
Field Details
-
left
-
middle
-
right
-
-
Constructor Details
-
Triple
public Triple()
-
-
Method Details
-
of
- Type Parameters:
L
-M
-R
-- Parameters:
l
-m
-r
-- Returns:
-
emptyArray
-
getLeft
Gets the left.- Returns:
-
setLeft
Sets the left.- Parameters:
left
- the new left
-
getMiddle
Gets the middle.- Returns:
-
setMiddle
Sets the middle.- Parameters:
middle
- the new middle
-
getRight
Gets the right.- Returns:
-
setRight
Sets the right.- Parameters:
right
- the new right
-
set
- Parameters:
left
-middle
-right
-
-
getAndSetLeft
Gets the and set left.- Parameters:
newLeft
-- Returns:
-
setAndGetLeft
Sets the and get left.- Parameters:
newLeft
-- Returns:
-
getAndSetMiddle
Gets the and set middle.- Parameters:
newMiddle
-- Returns:
-
setAndGetMiddle
Sets the and get middle.- Parameters:
newMiddle
-- Returns:
-
getAndSetRight
Gets the and set right.- Parameters:
newRight
-- Returns:
-
setAndGetRight
Sets the and get right.- Parameters:
newRight
-- Returns:
-
setLeftIf
public <E extends Exception> boolean setLeftIf(L newLeft, Throwables.BiPredicate<? super Triple<L, M, throws ER>, ? super L, E> predicate) Set to the specifiednewLeft
and returnstrue
ifpredicate
returns true. Otherwise returnsfalse
without setting the value to new value.- Type Parameters:
E
-- Parameters:
newLeft
-predicate
- - the first parameter is current pair, the second parameter is thenewLeft
- Returns:
- Throws:
E
- the e
-
setMiddleIf
public <E extends Exception> boolean setMiddleIf(M newMiddle, Throwables.BiPredicate<? super Triple<L, M, throws ER>, ? super M, E> predicate) Set to the specifiednewMiddle
and returnstrue
ifpredicate
returns true. Otherwise returnsfalse
without setting the value to new value.- Type Parameters:
E
-- Parameters:
newMiddle
-predicate
- - the first parameter is current pair, the second parameter is thenewMiddle
- Returns:
- Throws:
E
- the e
-
setRightIf
public <E extends Exception> boolean setRightIf(R newRight, Throwables.BiPredicate<? super Triple<L, M, throws ER>, ? super R, E> predicate) Set to the specifiednewRight
and returnstrue
ifpredicate
returns true. Otherwise returnsfalse
without setting the value to new value.- Type Parameters:
E
-- Parameters:
newRight
-predicate
- - the first parameter is current pair, the second parameter is thenewRight
- Returns:
- Throws:
E
- the e
-
setIf
public <E extends Exception> boolean setIf(L newLeft, M newMiddle, R newRight, Throwables.QuadPredicate<? super Triple<L, M, throws ER>, ? super L, ? super M, ? super R, E> predicate) Set to the specifiednewLeft
andnewRight
and returnstrue
ifpredicate
returns true. Otherwise returnsfalse
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 thenewLeft
, the third parameter is thenewMiddle
, the fourth parameter is thenewRight
- Returns:
- Throws:
E
- the e
-
reverse
Returns a new instance of Triple<R, M, L>.- Returns:
- a new instance of Triple<R, M, L>.
-
copy
-
toArray
-
toArray
public <A> A[] toArray(A[] a) - Type Parameters:
A
-- Parameters:
a
-- Returns:
-
forEach
- Type Parameters:
E
-- Parameters:
comsumer
-- Throws:
E
- the e
-
accept
public <E extends Exception> void accept(Throwables.TriConsumer<? super L, ? super M, throws E? super R, E> action) - Type Parameters:
E
-- Parameters:
action
-- Throws:
E
- the e
-
accept
public <E extends Exception> void accept(Throwables.Consumer<? super Triple<L, M, throws ER>, E> action) - Type Parameters:
E
-- Parameters:
action
-- Throws:
E
- the e
-
map
public <U,E extends Exception> U map(Throwables.TriFunction<? super L, ? super M, throws E? super R, U, E> mapper) - 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, throws ER>, U, E> mapper) - Type Parameters:
U
-E
-- Parameters:
mapper
-- Returns:
- Throws:
E
- the e
-
filter
public <E extends Exception> u.Optional<Triple<L,M, filterR>> (Throwables.TriPredicate<? super L, ? super M, throws E? super R, E> predicate) - Type Parameters:
E
-- Parameters:
predicate
-- Returns:
- Throws:
E
- the e
-
filter
public <E extends Exception> u.Optional<Triple<L,M, filterR>> (Throwables.Predicate<? super Triple<L, M, throws ER>, E> predicate) - Type Parameters:
E
-- Parameters:
predicate
-- Returns:
- Throws:
E
- the e
-
stream
-
stream
public <T,E extends Exception> Stream<T> stream(Throwables.Function<? super Triple<L, M, throws ER>, Stream<T>, E> func) - Throws:
E extends Exception
-
toOptional
-
toTuple
-
hashCode
public int hashCode() -
equals
-
toString
-