Package com.unboundid.util
Class ObjectPair<F,S>
- java.lang.Object
-
- com.unboundid.util.ObjectPair<F,S>
-
- Type Parameters:
F
- The type of the first object.S
- The type of the second object.
- All Implemented Interfaces:
java.io.Serializable
@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class ObjectPair<F,S> extends java.lang.Object implements java.io.Serializable
This class provides a typed pair of objects. It may be used whenever two objects are required but only one is allowed (e.g., returning two values from a method).- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ObjectPair(F first, S second)
Creates a new object pair with the provided elements.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
Indicates whether the provided object is equal to this object pair.F
getFirst()
Retrieves the first object in this pair.S
getSecond()
Retrieves the second object in this pair.int
hashCode()
Retrieves a hash code for this object pair.java.lang.String
toString()
Retrieves a string representation of this object pair.void
toString(java.lang.StringBuilder buffer)
Appends a string representation of this object pair to the provided buffer.
-
-
-
Constructor Detail
-
ObjectPair
public ObjectPair(@Nullable F first, @Nullable S second)
Creates a new object pair with the provided elements.- Parameters:
first
- The first object in this pair.second
- The second object in this pair.
-
-
Method Detail
-
getFirst
@Nullable public F getFirst()
Retrieves the first object in this pair.- Returns:
- The first object in this pair.
-
getSecond
@Nullable public S getSecond()
Retrieves the second object in this pair.- Returns:
- The second object in this pair.
-
hashCode
public int hashCode()
Retrieves a hash code for this object pair.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- A hash code for this object pair.
-
equals
public boolean equals(@Nullable java.lang.Object o)
Indicates whether the provided object is equal to this object pair.- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- The object for which to make the determination.- Returns:
true
if the provided object is equal to this object pair, orfalse
if not.
-
toString
@NotNull public java.lang.String toString()
Retrieves a string representation of this object pair.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of this object pair.
-
-