Package com.atlassian.crowd.embedded.api
Class UserComparator
java.lang.Object
com.atlassian.crowd.embedded.api.UserComparator
- All Implemented Interfaces:
Comparator<User>
Supplies re-useable methods for equals, hashcode and compareTo that can be shared with different implementations of
User in order to be compatible.
You can also instantiate this class to get a Comparator of User.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Function<User,UserComparator.Key> static final Comparator<User>Singleton instance of Comparator<User< -
Method Summary
Modifier and TypeMethodDescriptionintstatic intstatic booleanChecks whether the two User objects are equal according to the contract of theUserinterface.static booleanequalsObject(User user, 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
-
USER_COMPARATOR
Singleton instance of Comparator<User< -
KEY_MAKER
-
-
Method Details
-
equal
Checks whether the two User objects are equal according to the contract of theUserinterface.If you are implementing
User.equals(Object)then just write code like this:public boolean equals(Object o) { return (o instanceof User) && UserComparator.equal(this, (User) o); }- Parameters:
user1- First Useruser2- Second User- Returns:
- true if these are two equal Users.
-
equalsObject
-
hashCode
-
compareTo
-
compare
- Specified by:
comparein interfaceComparator<User>
-