Interface UnorderedPair<V>

Type Parameters:
V - the type of the elements that form the pair
All Known Implementing Classes:
NonNullUnorderedPair, SimpleUnorderedPair

public interface UnorderedPair<V>
An unordered pair.

This is a value-type.

Author:
Werner Randelshofer
  • Method Summary

    Modifier and Type
    Method
    Description
     
    default V
    getOther(V someone)
    Returns other() if someone is equal to either(), returns either() otherwise.
     
    static <V> boolean
    unorderedPairEquals(UnorderedPair<V> pair, @Nullable Object obj)
    Checks if a given ordered pair is equal to a given object.
    static <V> int
    Computes a hash code for an ordered pair.
  • Method Details

    • getOther

      default V getOther(V someone)
      Returns other() if someone is equal to either(), returns either() otherwise.
      Parameters:
      someone - either or other
      Returns:
    • either

      V either()
    • other

      V other()
    • unorderedPairEquals

      static <V> boolean unorderedPairEquals(UnorderedPair<V> pair, @Nullable Object obj)
      Checks if a given ordered pair is equal to a given object.
      Type Parameters:
      V - the type of the elements that form the pair
      Parameters:
      pair - an ordered pair
      obj - an object
      Returns:
      true if equal
    • unorderedPairHashCode

      static <V> int unorderedPairHashCode(UnorderedPair<V> pair)
      Computes a hash code for an ordered pair. The hash code is guaranteed to be non-zero.
      Type Parameters:
      V - the type of the elements that form the pair
      Parameters:
      pair - an ordered pair
      Returns:
      the hash code