public class UserComparator extends Object implements Comparator<User>
User
in order to be compatible.
You can also instantiate this class to get a Comparator of User.Modifier and Type | Class and Description |
---|---|
static class |
UserComparator.Key |
Modifier and Type | Field and Description |
---|---|
static com.google.common.base.Function<User,UserComparator.Key> |
KEY_MAKER
|
static Comparator<User> |
USER_COMPARATOR
Singleton instance of Comparator<User<
|
Modifier and Type | Method and Description |
---|---|
int |
compare(User user1,
User user2) |
static int |
compareTo(User user1,
User user2) |
static boolean |
equal(User user1,
User user2)
Checks whether the two User objects are equal according to the contract of the
User interface. |
static boolean |
equalsObject(User user,
Object o) |
static int |
hashCode(User user) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public static final Comparator<User> USER_COMPARATOR
public static com.google.common.base.Function<User,UserComparator.Key> KEY_MAKER
public static boolean equal(User user1, User user2)
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); }
user1
- First Useruser2
- Second Userpublic static int hashCode(User user)
public int compare(User user1, User user2)
compare
in interface Comparator<User>
Copyright © 2021 Atlassian. All rights reserved.