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:
Serializable
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class ObjectPair<F,S>
extends Object
implements 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:
-
Constructor Summary
ConstructorsConstructorDescriptionObjectPair(F first, S second) Creates a new object pair with the provided elements. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether the provided object is equal to this object pair.getFirst()Retrieves the first object in this pair.Retrieves the second object in this pair.inthashCode()Retrieves a hash code for this object pair.toString()Retrieves a string representation of this object pair.voidtoString(StringBuilder buffer) Appends a string representation of this object pair to the provided buffer.
-
Constructor Details
-
ObjectPair
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 Details
-
getFirst
Retrieves the first object in this pair.- Returns:
- The first object in this pair.
-
getSecond
Retrieves the second object in this pair.- Returns:
- The second object in this pair.
-
hashCode
Retrieves a hash code for this object pair. -
equals
Indicates whether the provided object is equal to this object pair. -
toString
Retrieves a string representation of this object pair. -
toString
Appends a string representation of this object pair to the provided buffer.- Parameters:
buffer- The buffer to which the information should be appended.
-