JavaScript is disabled on your browser.
  • Summary:
  • Nested |
  • Field |
  • Constr |
  • Method
  • Detail:
  • Field |
  • Constr |
  • Method
javolution.util.function

Interface Equality<T>

  • Type Parameters:
    T - the type of objects that may be compared for equality or order.
    All Superinterfaces:
    Comparator<T>


    public interface Equality<T>
    extends Comparator<T>

    A comparator to be used for element equality as well as for ordering. Implementing classes should ensure that:

    • The compare function is consistent with equals. If two objects compare to 0 then they are equals and the the reciprocal is true (this ensures that sorted collections/maps do not break the general contract of their parent class based on object equal).
    • The hashcode function is consistent with equals: If two objects are equals, they have the same hashcode (the reciprocal is not true).
    • The null value is supported (even for comparisons) and the hashcode value of null is 0.

    Version:
    6.0, July 21, 2013
    Author:
    Jean-Marie Dautelle
    See Also:
    Equalities
    • Method Summary

      Methods
      Modifier and Type Method and Description
      boolean areEqual (T left, T right)
      Indicates if the specified objects can be considered equal.
      int compare (T left, T right)
      Compares the specified objects for order.
      int hashCodeOf (T object)
      Returns the hash code for the specified object (consistent with areEqual(T, T)).
    • Method Detail

      • hashCodeOf

        int hashCodeOf(T object)
        Returns the hash code for the specified object (consistent with areEqual(T, T)). Two objects considered equal have the same hash code. The hash code of null is always 0.
        Parameters:
        object - the object to return the hashcode for.
        Returns:
        the hashcode for the specified object.
      • areEqual

        boolean areEqual(T left,
         T right)
        Indicates if the specified objects can be considered equal. This methods is equivalent to (compare(o1, o2) == 0) but usually faster.
        Parameters:
        left - the first object (or null).
        right - the second object (or null).
        Returns:
        true if both objects are considered equal; false otherwise.
      • compare

        int compare(T left,
         T right)
        Compares the specified objects for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, possibly equal to, or greater than the second. Implementation classes should ensure that comparisons with null is supported.
        Specified by:
        compare in interface Comparator<T>
        Parameters:
        left - the first object.
        right - the second object.
        Returns:
        a negative integer, zero, or a positive integer as the first argument is less than, possibly equal to, or greater than the second.
  • Summary:
  • Nested |
  • Field |
  • Constr |
  • Method
  • Detail:
  • Field |
  • Constr |
  • Method

Copyright © 2005-2013 Javolution. All Rights Reserved.

AltStyle によって変換されたページ (->オリジナル) /