EqualityComparator<Object>
public final class ObjectEqualityComparator extends AbstractEqualityComparator<Object>
EqualityComparator
uses object equality
for comparisons by calling Object.hashCode()
and Object.equals(java.lang.Object)
.Modifier and Type | Field | Description |
---|---|---|
static ObjectEqualityComparator |
INSTANCE |
Constructor | Description |
---|---|
ObjectEqualityComparator() |
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(Object a,
Object b) |
This method tests if two objects are equal.
|
int |
hashCode(Object obj) |
This method returns a hash code for the specified object.
|
public static final ObjectEqualityComparator INSTANCE
public int hashCode(Object obj)
This implementation returns
obj.
hashCode()
.
obj
- The object.obj
.public boolean equals(Object a, Object b)
This implementation relies on object equality. If both objects are
null
, this method returns true
. Otherwise if only
a
is null
, this method returns false
. Otherwise,
this method returns the result of
a.
equals
(b)
.
a
- The first object to compare.b
- The second object to compare.true
if a
equals b
, otherwise false
.Copyright © 1992–2018 ANTLR. All rights reserved.