com.atlassian.crowd.embedded.api
Class UserComparator
java.lang.Object
com.atlassian.crowd.embedded.api.UserComparator
- All Implemented Interfaces:
- java.util.Comparator<User>
public class UserComparator
- extends java.lang.Object
- implements java.util.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.
| 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 |
USER_COMPARATOR
public static final java.util.Comparator<User> USER_COMPARATOR
- Singleton instance of Comparator
KEY_MAKER
public static com.google.common.base.Function<User,UserComparator.Key> KEY_MAKER
- A
Function to turn Users into representative keys that sort in the same
order as this Comparator.
equal
public static boolean equal(User user1,
User user2)
- Checks whether the two User objects are equal according to the contract of the
User 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
public static boolean equalsObject(User user,
java.lang.Object o)
hashCode
public static int hashCode(User user)
compareTo
public static int compareTo(User user1,
User user2)
compare
public int compare(User user1,
User user2)
- Specified by:
compare in interface java.util.Comparator<User>
Copyright © 2012 Atlassian. All Rights Reserved.