Package com.atlassian.crowd.model.group
Class GroupComparator
java.lang.Object
com.atlassian.crowd.model.group.GroupComparator
- All Implemented Interfaces:
Comparator<Group>
Supplies re-useable methods for equals, hashcode and compareTo that can be shared with different implementations of
Group in order to be compatible.
You can also instantiate this class to get a Comparator of Group.
Note: the GroupComparator is distinct from the EmbeddedGroupComparator as
model groups take the directoryId into consideration when performing equals/hashCode/compareTo.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<Group>Singleton instance of Comparator<Group> -
Method Summary
Modifier and TypeMethodDescriptionintstatic intstatic booleanChecks whether the two Group objects are equal according to the contract of theGroupinterface.static booleanequalsObject(Group group, Object o) static intMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
GROUP_COMPARATOR
Singleton instance of Comparator<Group>
-
-
Method Details
-
equal
Checks whether the two Group objects are equal according to the contract of theGroupinterface.If you are implementing
DirectoryEntity.equals(Object)then just write code like this:public boolean equals(Object o) { return (o instanceof Group) && GroupComparator.equal(this, (Group) o); }- Parameters:
group1- First Groupgroup2- Second Group- Returns:
- true if these are two equal Groups.
-
equalsObject
-
hashCode
-
compareTo
-
compare
- Specified by:
comparein interfaceComparator<Group>
-