Package wt.util
Class Pair.UnorderedPair<T>
java.lang.Object
wt.util.Pair<T,T>
wt.util.Pair.UnorderedPair<T>
- All Implemented Interfaces:
Serializable
Aggregates an unordered pair of objects and handles them as a unique combination.
Two UnorderedPair objects will test equal if their component objects test equal in either order.
A UnorderedPair's hash code is a combination of its component object hash codes,
which allows them to be added to collections and used as map keys.
Supported API: true
Extendable: false
Supported API: true
Extendable: false
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class wt.util.Pair
Pair.UnorderedPair<T> -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a default UnorderedPair with null component objects.UnorderedPair(T obj1, T obj2) Construct an UnorderedPair object from components.UnorderedPair(Pair<T, T> pair) Construct an UnorderedPair copy. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTwo UnorderedPairs are equal if their two component objects are equal in either order.booleanequals(Pair.UnorderedPair otherPair, boolean reverseOrder) Determine if two UnorderedPair objects are equal in a specified order.Methods inherited from class wt.util.Pair
getAllObjs, getObj1, getObj2, isObj1Null, isObj2Null, setObj1, setObj2, setObjs, toString
-
Constructor Details
-
UnorderedPair
public UnorderedPair()Construct a default UnorderedPair with null component objects.
Supported API: true -
UnorderedPair
Construct an UnorderedPair object from components.
Supported API: true- Parameters:
obj1- Object 1.obj2- Object 2.
-
UnorderedPair
Construct an UnorderedPair copy. The pair's individual objects are referenced in the copy, not duplicated.
Supported API: true- Parameters:
pair- Pair object to be copied.
-
-
Method Details
-
equals
Two UnorderedPairs are equal if their two component objects are equal in either order. A UnorderedPair and a Pair are equal if their two component objects are equal in their defined order only. Component objects are compared using their equals() method.
Supported API: true -
equals
Determine if two UnorderedPair objects are equal in a specified order.
Supported API: true- Parameters:
otherPair- Other UnorderedPair to be tested against this one.reverseOrder- True to test equality of the component objects in reverse order, false to test in the defined order.- Returns:
- True if both component objects are equal in the specified order.
-