Package com.landawn.abacus.util
Class Chain
java.lang.Object
com.landawn.abacus.util.Chain
- Author:
- HaiYang Li
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
The Class ComparisonChain.static final class
The Class EquivalenceChain.static final class
The Class HashCodeChain. -
Method Summary
Modifier and TypeMethodDescriptionstatic Chain.ComparisonChain
compare
(byte left, byte right) Compares twobyte
values as specified byCommonUtil.compare(boolean, boolean)
, if the result of this comparison chain has not already been determined.static Chain.ComparisonChain
compare
(char left, char right) Compares twochar
values as specified byCommonUtil.compare(boolean, boolean)
, if the result of this comparison chain has not already been determined.static Chain.ComparisonChain
compare
(double left, double right) Compares twodouble
values as specified byDouble.compare(double, double)
, if the result of this comparison chain has not already been determined.static Chain.ComparisonChain
compare
(float left, float right) Compares twofloat
values as specified byFloat.compare(float, float)
, if the result of this comparison chain has not already been determined.static Chain.ComparisonChain
compare
(int left, int right) Compares twoint
values as specified byCommonUtil.compare(boolean, boolean)
, if the result of this comparison chain has not already been determined.static Chain.ComparisonChain
compare
(long left, long right) Compares twolong
values as specified byCommonUtil.compare(boolean, boolean)
, if the result of this comparison chain has not already been determined.static Chain.ComparisonChain
compare
(short left, short right) Compares twoshort
values as specified byCommonUtil.compare(boolean, boolean)
, if the result of this comparison chain has not already been determined.static <T extends Comparable<? super T>>
Chain.ComparisonChaincompare
(T left, T right) Compares two comparable objects as specified byComparable.compareTo(T)
, if the result of this comparison chain has not already been determined.static <T,
E extends Exception>
Chain.ComparisonChaincompare
(T left, T right, Throwables.BiFunction<? super T, ? super T, Integer, E> func) static <T> Chain.ComparisonChain
compare
(T left, T right, Comparator<T> comparator) Compares two objects using a comparator, if the result of this comparison chain has not already been determined.static Chain.ComparisonChain
compareFalseLess
(boolean left, boolean right) Compares twoboolean
values, consideringfalse
to be less thantrue
, if the result of this comparison chain has not already been determined.static <T extends Comparable<? super T>>
Chain.ComparisonChaincompareNullBigger
(T left, T right) null
is bigger.static <T extends Comparable<? super T>>
Chain.ComparisonChaincompareNullLess
(T left, T right) null
is smaller.static Chain.ComparisonChain
compareTrueLess
(boolean left, boolean right) Compares twoboolean
values, consideringtrue
to be less thanfalse
, if the result of this comparison chain has not already been determined.static Chain.EquivalenceChain
equals
(boolean left, boolean right) Compares twoboolean
values as specified byleft == right
, if the result of this equivalence chain has not already been determined.static Chain.EquivalenceChain
equals
(byte left, byte right) Compares twobyte
values as specified byleft == right
, if the result of this equivalence chain has not already been determined.static Chain.EquivalenceChain
equals
(char left, char right) Compares twochar
values as specified byleft == right
, if the result of this equivalence chain has not already been determined.static Chain.EquivalenceChain
equals
(double left, double right) Compares twodouble
values as specified byDouble.compare(double, double)
, if the result of this equivalence chain has not already been determined.static Chain.EquivalenceChain
equals
(float left, float right) Compares twofloat
values as specified byFloat.compare(float, float)
, if the result of this equivalence chain has not already been determined.static Chain.EquivalenceChain
equals
(int left, int right) Compares twoint
values as specified byleft == right
, if the result of this equivalence chain has not already been determined.static Chain.EquivalenceChain
equals
(long left, long right) Compares twolong
values as specified byleft == right
, if the result of this equivalence chain has not already been determined.static Chain.EquivalenceChain
equals
(short left, short right) Compares twoshort
values as specified byleft == right
, if the result of this equivalence chain has not already been determined.static Chain.EquivalenceChain
Compares two comparable objects as specified byCommonUtil.equals(Object, Object)
, if the result of this equivalence chain has not already been determined.static <T,
E extends Exception>
Chain.EquivalenceChainequals
(T left, T right, Throwables.BiFunction<? super T, ? super T, Boolean, E> func) static Chain.HashCodeChain
hash
(boolean value) Add the hash code of the specifiedvalue
to result.static Chain.HashCodeChain
hash
(byte value) Add the hash code of the specifiedvalue
to result.static Chain.HashCodeChain
hash
(char value) Add the hash code of the specifiedvalue
to result.static Chain.HashCodeChain
hash
(double value) Add the hash code of the specifiedvalue
to result.static Chain.HashCodeChain
hash
(float value) Add the hash code of the specifiedvalue
to result.static Chain.HashCodeChain
hash
(int value) Add the hash code of the specifiedvalue
to result.static Chain.HashCodeChain
hash
(long value) Add the hash code of the specifiedvalue
to result.static Chain.HashCodeChain
hash
(short value) Add the hash code of the specifiedvalue
to result.static Chain.HashCodeChain
Add the hash code of the specifiedvalue
to result.static <T,
E extends Exception>
Chain.HashCodeChainhash
(T value, Throwables.ToIntFunction<? super T, E> func)
-
Method Details
-
compare
Compares two comparable objects as specified byComparable.compareTo(T)
, if the result of this comparison chain has not already been determined.- Type Parameters:
T
-- Parameters:
left
-right
-- Returns:
ComparisonChain
-
compare
Compares two objects using a comparator, if the result of this comparison chain has not already been determined.- Type Parameters:
T
-- Parameters:
left
-right
-comparator
-- Returns:
ComparisonChain
-
compare
public static <T,E extends Exception> Chain.ComparisonChain compare(T left, T right, Throwables.BiFunction<? super T, ? super T, throws EInteger, E> func) - Type Parameters:
T
-E
-- Parameters:
left
-right
-func
-- Returns:
- Throws:
E
- the e
-
compareNullLess
public static <T extends Comparable<? super T>> Chain.ComparisonChain compareNullLess(T left, T right) null
is smaller.- Type Parameters:
T
-- Parameters:
left
-right
-- Returns:
-
compareNullBigger
public static <T extends Comparable<? super T>> Chain.ComparisonChain compareNullBigger(T left, T right) null
is bigger.- Type Parameters:
T
-- Parameters:
left
-right
-- Returns:
-
compareFalseLess
Compares twoboolean
values, consideringfalse
to be less thantrue
, if the result of this comparison chain has not already been determined.- Parameters:
left
-right
-- Returns:
ComparisonChain
-
compareTrueLess
Compares twoboolean
values, consideringtrue
to be less thanfalse
, if the result of this comparison chain has not already been determined.- Parameters:
left
-right
-- Returns:
ComparisonChain
-
compare
Compares twochar
values as specified byCommonUtil.compare(boolean, boolean)
, if the result of this comparison chain has not already been determined.- Parameters:
left
-right
-- Returns:
ComparisonChain
-
compare
Compares twobyte
values as specified byCommonUtil.compare(boolean, boolean)
, if the result of this comparison chain has not already been determined.- Parameters:
left
-right
-- Returns:
ComparisonChain
-
compare
Compares twoshort
values as specified byCommonUtil.compare(boolean, boolean)
, if the result of this comparison chain has not already been determined.- Parameters:
left
-right
-- Returns:
ComparisonChain
-
compare
Compares twoint
values as specified byCommonUtil.compare(boolean, boolean)
, if the result of this comparison chain has not already been determined.- Parameters:
left
-right
-- Returns:
ComparisonChain
-
compare
Compares twolong
values as specified byCommonUtil.compare(boolean, boolean)
, if the result of this comparison chain has not already been determined.- Parameters:
left
-right
-- Returns:
ComparisonChain
-
compare
Compares twofloat
values as specified byFloat.compare(float, float)
, if the result of this comparison chain has not already been determined.- Parameters:
left
-right
-- Returns:
ComparisonChain
-
compare
Compares twodouble
values as specified byDouble.compare(double, double)
, if the result of this comparison chain has not already been determined.- Parameters:
left
-right
-- Returns:
ComparisonChain
-
equals
Compares two comparable objects as specified byCommonUtil.equals(Object, Object)
, if the result of this equivalence chain has not already been determined.- Parameters:
left
-right
-- Returns:
EquivalenceChain
-
equals
public static <T,E extends Exception> Chain.EquivalenceChain equals(T left, T right, Throwables.BiFunction<? super T, ? super T, throws EBoolean, E> func) - Type Parameters:
T
-E
-- Parameters:
left
-right
-func
-- Returns:
- Throws:
E
- the e
-
equals
Compares twoboolean
values as specified byleft == right
, if the result of this equivalence chain has not already been determined.- Parameters:
left
-right
-- Returns:
EquivalenceChain
-
equals
Compares twochar
values as specified byleft == right
, if the result of this equivalence chain has not already been determined.- Parameters:
left
-right
-- Returns:
EquivalenceChain
-
equals
Compares twobyte
values as specified byleft == right
, if the result of this equivalence chain has not already been determined.- Parameters:
left
-right
-- Returns:
EquivalenceChain
-
equals
Compares twoshort
values as specified byleft == right
, if the result of this equivalence chain has not already been determined.- Parameters:
left
-right
-- Returns:
EquivalenceChain
-
equals
Compares twoint
values as specified byleft == right
, if the result of this equivalence chain has not already been determined.- Parameters:
left
-right
-- Returns:
EquivalenceChain
-
equals
Compares twolong
values as specified byleft == right
, if the result of this equivalence chain has not already been determined.- Parameters:
left
-right
-- Returns:
EquivalenceChain
-
equals
Compares twofloat
values as specified byFloat.compare(float, float)
, if the result of this equivalence chain has not already been determined.- Parameters:
left
-right
-- Returns:
EquivalenceChain
-
equals
Compares twodouble
values as specified byDouble.compare(double, double)
, if the result of this equivalence chain has not already been determined.- Parameters:
left
-right
-- Returns:
EquivalenceChain
-
hash
Add the hash code of the specifiedvalue
to result.- Parameters:
value
-- Returns:
- this
-
hash
public static <T,E extends Exception> Chain.HashCodeChain hash(T value, Throwables.ToIntFunction<? super T, E> func) throws E- Type Parameters:
T
-E
-- Parameters:
value
-func
-- Returns:
- Throws:
E
- the e
-
hash
Add the hash code of the specifiedvalue
to result.- Parameters:
value
-- Returns:
- this
-
hash
Add the hash code of the specifiedvalue
to result.- Parameters:
value
-- Returns:
- this
-
hash
Add the hash code of the specifiedvalue
to result.- Parameters:
value
-- Returns:
- this
-
hash
Add the hash code of the specifiedvalue
to result.- Parameters:
value
-- Returns:
- this
-
hash
Add the hash code of the specifiedvalue
to result.- Parameters:
value
-- Returns:
- this
-
hash
Add the hash code of the specifiedvalue
to result.- Parameters:
value
-- Returns:
- this
-
hash
Add the hash code of the specifiedvalue
to result.- Parameters:
value
-- Returns:
- this
-
hash
Add the hash code of the specifiedvalue
to result.- Parameters:
value
-- Returns:
- this
-