Package com.google.common.collect
Class ComparisonChain.InactiveComparisonChain
- java.lang.Object
-
- com.google.common.collect.ComparisonChain
-
- com.google.common.collect.ComparisonChain.InactiveComparisonChain
-
- Enclosing class:
- ComparisonChain
private static final class ComparisonChain.InactiveComparisonChain extends ComparisonChain
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int
result
-
Constructor Summary
Constructors Constructor Description InactiveComparisonChain(int result)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.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.ComparisonChain
compare(int left, int right)
Compares twoint
values as specified byInts.compare(int, int)
, if the result of this comparison chain has not already been determined.ComparisonChain
compare(long left, long right)
Compares twolong
values as specified byLongs.compare(long, long)
, if the result of this comparison chain has not already been determined.ComparisonChain
compare(java.lang.Comparable<?> left, java.lang.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, 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 twoboolean
values, consideringfalse
to be less thantrue
, if the result of this comparison chain has not already been determined.ComparisonChain
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
-
-
-
-
Method Detail
-
compare
public ComparisonChain compare(java.lang.Comparable<?> left, java.lang.Comparable<?> right)
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
public <T> ComparisonChain compare(T left, T right, java.util.Comparator<T> comparator)
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
public ComparisonChain compare(int left, int right)
Description copied from class:ComparisonChain
Compares twoint
values as specified byInts.compare(int, int)
, if the result of this comparison chain has not already been determined.- Specified by:
compare
in classComparisonChain
-
compare
public ComparisonChain compare(long left, long right)
Description copied from class:ComparisonChain
Compares twolong
values as specified byLongs.compare(long, long)
, if the result of this comparison chain has not already been determined.- Specified by:
compare
in classComparisonChain
-
compare
public ComparisonChain compare(float left, float right)
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
public ComparisonChain compare(double left, double right)
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
public ComparisonChain compareTrueFirst(boolean left, boolean right)
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.- Specified by:
compareTrueFirst
in classComparisonChain
-
compareFalseFirst
public ComparisonChain compareFalseFirst(boolean left, boolean right)
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.- 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
-
-