Package org.sklsft.commons.api.model
Class Pair<L,R>
java.lang.Object
org.sklsft.commons.api.model.Pair<L,R>
- Type Parameters:
L- the left element typeR- the right element type
- All Implemented Interfaces:
Serializable,Map.Entry<L,R>
A pair consisting of two elements.
This class is an abstract implementation defining the basic API. It refers to
the elements as 'left' and 'right'. It also implements the Map.Entry
interface where the key is 'left' and the value is 'right'.
- Author:
- Jerome RANCATI
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Pair
-
Pair
public Pair()
-
-
Method Details
-
getLeft
-
setLeft
-
getRight
-
setRight
-
getKey
-
getValue
-
setValue
-
of
-
toString
Returns a String representation of this pair using the format
($left,$right). -
equals
-
hashCode
public int hashCode()Returns a suitable hash code. The hash code follows the definition in
Map.Entry. -
toString
Formats the receiver using the given format.
This uses
Formattableto perform the formatting. Two variables may be used to embed the left and right elements. Use%1$sfor the left element (key) and%2$sfor the right element (value). The default format used bytoString()is(%1$s,%2$s).- Parameters:
format- the format string, optionally containing%1$sand%2$s, not null- Returns:
- the formatted string, not null
-