Package org.eclipse.xtext.xbase.lib
Class Pair<K,V>
- java.lang.Object
-
- org.eclipse.xtext.xbase.lib.Pair<K,V>
-
- Type Parameters:
K- the key-type of the pair.V- the value-type of the pair.
- All Implemented Interfaces:
java.io.Serializable
@GwtCompatible public final class Pair<K,V> extends java.lang.Object implements java.io.SerializableAn immutable pair ofkeyandvalue. A pair is considered to beequalto another pair if both the key and the value are equal.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)KgetKey()Returns the key.VgetValue()Returns the value.inthashCode()static <K,V>
Pair<K,V>of(K k, V v)Creates a new instance with the given key and value.java.lang.StringtoString()
-
-
-
Method Detail
-
of
@Pure public static <K,V> Pair<K,V> of(K k, V v)
Creates a new instance with the given key and value. May be used instead of the constructor for convenience reasons.- Parameters:
k- the key. May benull.v- the value. May benull.- Returns:
- a newly created pair. Never
null. - Since:
- 2.3
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-