Class ComparisonChain.InactiveComparisonChain
- Enclosing class:
ComparisonChain
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncompare
(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.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.compare
(int left, int right) Compares twoint
values as specified byInteger.compare(int, int)
, if the result of this comparison chain has not already been determined.compare
(long left, long right) Compares twolong
values as specified byLong.compare(long, long)
, if the result of this comparison chain has not already been determined.compare
(Comparable<?> left, Comparable<?> right) Compares two comparable objects as specified byComparable.compareTo(T)
, if the result of this comparison chain has not already been determined.<T> 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.compareFalseFirst
(boolean left, boolean right) Compares twoboolean
values, consideringfalse
to be less thantrue
, if the result of this comparison chain has not already been determined.compareTrueFirst
(boolean left, boolean right) Compares twoboolean
values, consideringtrue
to be less thanfalse
, if the result of this comparison chain has not already been determined.int
result()
Ends this comparison chain and returns its result: a value having the same sign as the first nonzero comparison result in the chain, or zero if every result was zero.Methods inherited from class com.google.common.collect.ComparisonChain
compare, start
-
Field Details
-
result
final int result
-
-
Constructor Details
-
InactiveComparisonChain
InactiveComparisonChain(int result)
-
-
Method Details
-
compare
Description copied from class:ComparisonChain
Compares two comparable objects as specified byComparable.compareTo(T)
, if the result of this comparison chain has not already been determined.This method is declared to accept any 2
Comparable
objects, even if they are not mutually comparable. If you pass objects that are not mutually comparable, this method may throw an exception. (The reason for this decision is lost to time, but the reason might be that we wanted to support legacy classes that implement the raw typeComparable
(instead of implementingComparable<Foo>
) without producing warnings. If so, we would prefer today to produce warnings in that case, and we may change this method to do so in the future. Support for rawComparable
types in Guava in general is tracked as #989.)- Specified by:
compare
in classComparisonChain
-
compare
Description copied from class:ComparisonChain
Compares two objects using a comparator, if the result of this comparison chain has not already been determined.- Specified by:
compare
in classComparisonChain
-
compare
Description copied from class:ComparisonChain
Compares twoint
values as specified byInteger.compare(int, int)
, if the result of this comparison chain has not already been determined.- Specified by:
compare
in classComparisonChain
-
compare
Description copied from class:ComparisonChain
Compares twolong
values as specified byLong.compare(long, long)
, if the result of this comparison chain has not already been determined.- Specified by:
compare
in classComparisonChain
-
compare
Description copied from class:ComparisonChain
Compares twofloat
values as specified byFloat.compare(float, float)
, if the result of this comparison chain has not already been determined.- Specified by:
compare
in classComparisonChain
-
compare
Description copied from class:ComparisonChain
Compares twodouble
values as specified byDouble.compare(double, double)
, if the result of this comparison chain has not already been determined.- Specified by:
compare
in classComparisonChain
-
compareTrueFirst
Description copied from class:ComparisonChain
Compares twoboolean
values, consideringtrue
to be less thanfalse
, if the result of this comparison chain has not already been determined.Java 8+ users: you can get the equivalent from
Booleans.trueFirst()
. For example:Comparator.comparing(Foo::isBar,
Booleans.trueFirst()
)- Specified by:
compareTrueFirst
in classComparisonChain
-
compareFalseFirst
Description copied from class:ComparisonChain
Compares twoboolean
values, consideringfalse
to be less thantrue
, if the result of this comparison chain has not already been determined.Java 8+ users: you can get the equivalent from
Booleans.falseFirst()
. For example:Comparator.comparing(Foo::isBar,
Booleans.falseFirst()
)- Specified by:
compareFalseFirst
in classComparisonChain
-
result
public int result()Description copied from class:ComparisonChain
Ends this comparison chain and returns its result: a value having the same sign as the first nonzero comparison result in the chain, or zero if every result was zero.- Specified by:
result
in classComparisonChain
-