org.eigenbase.util
Class Pair<T1,T2>
java.lang.Object
org.eigenbase.util.Pair<T1,T2>
public class Pair<T1,T2>
- extends Object
Pair of objects.
- Since:
- Oct 17, 2007
- Version:
- $Id: //open/dev/farrago/src/org/eigenbase/util/Pair.java#4 $
- Author:
- jhyde
Constructor Summary |
Pair(T1 left,
T2 right)
Creates a Pair. |
left
public final T1 left
right
public final T2 right
Pair
public Pair(T1 left,
T2 right)
- Creates a Pair.
- Parameters:
left
- left valueright
- right value
equals
public boolean equals(Object obj)
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
toMap
public static <K,V> Map<K,V> toMap(Collection<Pair<K,V>> pairs)
- Converts a collection of Pairs into a Map.
This is an obvious thing to do because Pair is similar in structure to
Map.Entry
.
The map contains a copy of the collection of Pairs; if you change the
collection, the map does not change.
- Parameters:
pairs
- Collection of Pair objects
- Returns:
- map with the same contents as the collection