Class ImmutablePair<L,R>
java.lang.Object
net.dv8tion.jda.internal.utils.tuple.Pair<L,R>
net.dv8tion.jda.internal.utils.tuple.ImmutablePair<L,R>
- Type Parameters:
L
- the left element typeR
- the right element type
- All Implemented Interfaces:
Serializable
This class has been copied from Lang 3
An immutable pair consisting of two Object
elements.
Although the implementation is immutable, there is no restriction on the objects
that may be stored. If mutable objects are stored in the pair, then the pair
itself effectively becomes mutable. The class is also final
, so a subclass
can not add undesirable behaviour.
#ThreadSafe# if both paired objects are thread-safe
- Since:
- Lang 3.0
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
left
Left object -
right
Right object
-
-
Constructor Details
-
ImmutablePair
Create a new pair instance.- Parameters:
left
- the left value, may be nullright
- the right value, may be null
-
-
Method Details
-
of
Obtains an immutable pair of from two objects inferring the generic types.
This factory allows the pair to be created using inference to obtain the generic types.
- Type Parameters:
L
- the left element typeR
- the right element type- Parameters:
left
- the left element, may be nullright
- the right element, may be null- Returns:
- a pair formed from the two parameters, not null
-
getLeft
Description copied from class:Pair
Gets the left element from this pair.
When treated as a key-value pair, this is the key.
-
getRight
Description copied from class:Pair
Gets the right element from this pair.
When treated as a key-value pair, this is the value.
-