public final class Comparables extends Object
Comparable
instances.Modifier and Type | Field and Description |
---|---|
static Comparator<Comparable> |
COMPARATOR
Provides the same comparision logic as
compare(java.lang.Comparable, java.lang.Comparable) does, but in a
form of a Comparator . |
Modifier and Type | Method and Description |
---|---|
static Comparable |
canonicalizeForHashLookup(Comparable value)
Canonicalizes the given
Comparable value for the purpose of a
hash-based lookup. |
static int |
compare(Comparable lhs,
Comparable rhs)
Compares the provided
Comparable instances. |
static boolean |
equal(Comparable lhs,
Comparable rhs)
Checks the provided
Comparable instances for equality. |
public static final Comparator<Comparable> COMPARATOR
compare(java.lang.Comparable, java.lang.Comparable)
does, but in a
form of a Comparator
.public static boolean equal(Comparable lhs, Comparable rhs)
Comparable
instances for equality.
Special numeric comparison logic is used for Double
, Long
,
Float
, Integer
, Short
and Byte
. See
Numbers.equal(Number, Number)
for more details.
lhs
- the left-hand side Comparable
. Can't be null
.rhs
- the right-hand side Comparable
. May be null
.true
if the provided comparables are equal, false
otherwise.public static int compare(Comparable lhs, Comparable rhs)
Comparable
instances.
Special numeric comparison logic is used for Double
, Long
,
Float
, Integer
, Short
and Byte
. See
Numbers.compare(Comparable, Comparable)
for more details.
lhs
- the left-hand side Comparable
. Can't be null
.rhs
- the right-hand side Comparable
. Can't be null
.Comparable
is less than, equal to, or greater than the
right-hand side Comparable
.public static Comparable canonicalizeForHashLookup(Comparable value)
Comparable
value for the purpose of a
hash-based lookup.
Special numeric canonicalization logic is used for Double
,
Long
, Float
, Integer
, Short
and
Byte
. See Numbers.canonicalizeForHashLookup(java.lang.Comparable)
for more
details.
value
- the Comparable
to canonicalize.Comparable
or
the original Comparable
if there is no special canonical
representation for it.Copyright © 2019 Hazelcast, Inc.. All Rights Reserved.