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
-
Field Summary
Modifier and TypeFieldDescriptionstatic Function<User,
UserComparator.Key> static final Comparator<User>
Singleton instance of Comparator<User< -
Method Summary
Modifier and TypeMethodDescriptionint
static int
static boolean
Checks whether the two User objects are equal according to the contract of theUser
interface.static boolean
equalsObject
(User user, Object o) static int
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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 theUser
interface.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:
compare
in interfaceComparator<User>
-