public class EqualsCheckerCollection extends AbstractEqualsChecker<Object>
EqualsChecker that recursively checks Collections based on a given
EqualsChecker delegate. So if two objects should be checked for equality
that are both Collections of the same kind, this implementation will check if they have the same length and
then recursively check the contained elements. For objects of other types it will
delegate to the EqualsChecker given at construction. This way you can simply check if two Collections
have the same or
equal elements. List and Set or
only different implementations of List with same elements to be considered as equal) you can extend
this class and override isEqualCollectionType(Collection, Collection).| Modifier and Type | Field and Description |
|---|---|
private EqualsChecker<Object> |
delegate
The delegate to check regular objects.
|
private static long |
serialVersionUID |
| Constructor and Description |
|---|
EqualsCheckerCollection(EqualsChecker<Object> delegate)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
isEqualCollectionType(Collection<?> collection1,
Collection<?> collection2)
This method is called from
isEqualNotNull(Object, Object) to check if the type
of two given Collections should be considered as equal. |
protected boolean |
isEqualNotNull(Object value1,
Object value2)
Called from
AbstractEqualsChecker.isEqual(Object, Object) if objects are both NOT same and NOT null. |
isEqualprivate static final long serialVersionUID
private final EqualsChecker<Object> delegate
public EqualsCheckerCollection(EqualsChecker<Object> delegate)
delegate - is the EqualsChecker used to check objects other than Collections.protected boolean isEqualNotNull(Object value1, Object value2)
AbstractEqualsCheckerAbstractEqualsChecker.isEqual(Object, Object) if objects are both NOT same and NOT null.isEqualNotNull in class AbstractEqualsChecker<Object>value1 - is the first value to check.value2 - is the first value to check.true if the given values are considered as equal, false otherwise.protected boolean isEqualCollectionType(Collection<?> collection1, Collection<?> collection2)
isEqualNotNull(Object, Object) to check if the type
of two given Collections should be considered as equal.collection1 - is the first Collection.collection2 - is the second Collection.true if the type of the given Collections is considered as equal,
false otherwise.Copyright © 2001–2016 mmm-Team. All rights reserved.