- 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 TypeMethodDescriptioneither()default VReturns other() if someone is equal to either(), returns either() otherwise.other()static <V> booleanunorderedPairEquals(@NonNull UnorderedPair<V> pair, @Nullable Object obj) Checks if a given ordered pair is equal to a given object.static <V> intunorderedPairHashCode(@NonNull UnorderedPair<V> pair) Computes a hash code for an ordered pair.
-
Method Details
-
getOther
Returns other() if someone is equal to either(), returns either() otherwise.- Parameters:
someone- either or other- Returns:
-
either
V either() -
other
V other() -
unorderedPairEquals
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 pairobj- an object- Returns:
- true if equal
-
unorderedPairHashCode
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
-