Package tk.airshipcraft.commonlib.utils
Class Pair<L,R>
java.lang.Object
tk.airshipcraft.commonlib.utils.Pair<L,R>
- Type Parameters:
L
- The type of the left element.R
- The type of the right element.
A utility class representing a pair of objects.
- Since:
- 2023-10-11
- Version:
- 1.0.0
- Author:
- eerieXanthic, notzune
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Pair
Constructs a new Pair with the specified values.- Parameters:
left
- The left element, must not be null.right
- The right element, must not be null.- Throws:
NullPointerException
- if either left or right is null.
-
-
Method Details
-
of
Creates a new Pair with the specified values. This method is a shorthand for creating a new Pair instance.- Type Parameters:
L
- The type of the left element.R
- The type of the right element.- Parameters:
left
- The left element, must not be null.right
- The right element, must not be null.- Returns:
- A new
Pair<L, R>
instance. - Throws:
NullPointerException
- if either left or right is null.
-
getLeft
Returns the left element of the pair.- Returns:
- The left element.
-
getRight
Returns the right element of the pair.- Returns:
- The right element.
-
hashCode
public int hashCode() -
equals
-
toString
-