public class

UserComparator

extends Object
implements Comparator<T>
java.lang.Object
   ↳ com.atlassian.crowd.embedded.api.UserComparator

Class Overview

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.

Summary

Fields
public static final Comparator<User> USER_COMPARATOR Singleton instance of Comparator
Public Methods
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)
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.util.Comparator

Fields

public static final Comparator<User> USER_COMPARATOR

Singleton instance of Comparator

Public Methods

public int compare (User user1, User user2)

public static int compareTo (User user1, User user2)

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 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 User
user2 Second User
Returns
  • true if these are two equal Users.

public static boolean equalsObject (User user, Object o)

public static int hashCode (User user)