private static final class ComparisonChain.InactiveComparisonChain extends ComparisonChain
Modifier and Type | Field and Description |
---|---|
(package private) int |
result |
Constructor and Description |
---|
InactiveComparisonChain(int result) |
Modifier and Type | Method and Description |
---|---|
ComparisonChain |
compare(java.lang.Comparable<?> left,
java.lang.Comparable<?> right)
Compares two comparable objects as specified by
Comparable.compareTo(T) , if the
result of this comparison chain has not already been determined. |
ComparisonChain |
compare(double left,
double right)
Compares two
double values as specified by Double.compare(double, double) , if the result
of this comparison chain has not already been determined. |
ComparisonChain |
compare(float left,
float right)
Compares two
float values as specified by Float.compare(float, float) , if the result
of this comparison chain has not already been determined. |
ComparisonChain |
compare(int left,
int right)
Compares two
int values as specified by Ints.compare(int, int) , if the result of
this comparison chain has not already been determined. |
ComparisonChain |
compare(long left,
long right)
Compares two
long values as specified by Longs.compare(long, long) , if the result of
this comparison chain has not already been determined. |
<T> ComparisonChain |
compare(T left,
T right,
java.util.Comparator<T> comparator)
Compares two objects using a comparator, if the result of this comparison chain has not
already been determined.
|
ComparisonChain |
compareFalseFirst(boolean left,
boolean right)
Compares two
boolean values, considering false to be less than true ,
if the result of this comparison chain has not already been determined. |
ComparisonChain |
compareTrueFirst(boolean left,
boolean right)
Compares two
boolean values, considering true to be less than false ,
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.
|
compare, start
public ComparisonChain compare(java.lang.Comparable<?> left, java.lang.Comparable<?> right)
ComparisonChain
Comparable.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 type Comparable
(instead of
implementing Comparable<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 raw Comparable
types in Guava in general is tracked as #989.)
compare
in class ComparisonChain
public <T> ComparisonChain compare(T left, T right, java.util.Comparator<T> comparator)
ComparisonChain
compare
in class ComparisonChain
public ComparisonChain compare(int left, int right)
ComparisonChain
int
values as specified by Ints.compare(int, int)
, if the result of
this comparison chain has not already been determined.compare
in class ComparisonChain
public ComparisonChain compare(long left, long right)
ComparisonChain
long
values as specified by Longs.compare(long, long)
, if the result of
this comparison chain has not already been determined.compare
in class ComparisonChain
public ComparisonChain compare(float left, float right)
ComparisonChain
float
values as specified by Float.compare(float, float)
, if the result
of this comparison chain has not already been determined.compare
in class ComparisonChain
public ComparisonChain compare(double left, double right)
ComparisonChain
double
values as specified by Double.compare(double, double)
, if the result
of this comparison chain has not already been determined.compare
in class ComparisonChain
public ComparisonChain compareTrueFirst(boolean left, boolean right)
ComparisonChain
boolean
values, considering true
to be less than false
,
if the result of this comparison chain has not already been determined.compareTrueFirst
in class ComparisonChain
public ComparisonChain compareFalseFirst(boolean left, boolean right)
ComparisonChain
boolean
values, considering false
to be less than true
,
if the result of this comparison chain has not already been determined.compareFalseFirst
in class ComparisonChain
public int result()
ComparisonChain
result
in class ComparisonChain