Class UserComparator

java.lang.Object
com.atlassian.crowd.embedded.api.UserComparator
All Implemented Interfaces:
Comparator<User>

public class UserComparator extends Object implements 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.
  • Field Details

  • Method Details

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

      public static boolean equalsObject(User user, 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 Comparator<User>