Package Struct
Class Pair<A,B>
java.lang.Object
Struct.Pair<A,B>
- Type Parameters:
A
- the type of the first element in the pair.B
- the type of the second element in the pair.
The
Pair
class stores two related objects of potentially different types.
It is a simple generic container for two elements, commonly known as a tuple.- Since:
- 1.0
- Version:
- 1.0
- Author:
- Sahasrad Chippa
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
a
The value stored as the first element. -
b
The value stored as the second element.
-
-
Constructor Details
-
Pair
public Pair()Constructs a defaultPair
with both elements initialized tonull
. -
Pair
-
-
Method Details
-
toString
-
toString
Returns a string representation of this pair using custom specified delimiters.- Parameters:
prefix
- the prefix stringdelimiter
- the delimiter between elementssuffix
- the suffix string- Returns:
- a formatted string containing the pair's elements
-