Class Overview
This comparator compares two given objects and is null safe.
Summary
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
|
From interface
java.util.Comparator
int
|
compare(T arg0, T arg1)
|
boolean
|
equals(Object arg0)
|
|
Public Constructors
Public Methods
public
int
compare
(Object o1, Object o2)
Compares two given objects. Returns 0 if both objects are null, 1 if o2
is null, -1 if o1 is null. In case when both objects are not null,
returns the result of o1.compareTo(o2) as long as o1 implements
Comparable, otherwise returns 0.
Note that if o1 is an instance of Comparable
and o2 is not of
the same type may result in ClassCastException
.
Parameters
o1
| object to compare |
o2
| object to compare |