Package mondrian.util
Class Pair<L,R>
- java.lang.Object
-
- mondrian.util.Pair<L,R>
-
- All Implemented Interfaces:
Comparable<Pair<L,R>>,Map.Entry<L,R>
- Direct Known Subclasses:
SchemaKey
public class Pair<L,R> extends Object implements Comparable<Pair<L,R>>, Map.Entry<L,R>
Pair of values.Because a pair implements
equals(Object),hashCode()andcompareTo(Pair), it can be used in any kind ofCollection.- Since:
- Apr 19, 2007
- Author:
- jhyde
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Pair<L,R> that)booleanequals(Object obj)LgetKey()RgetValue()inthashCode()static <L,R>
List<L>left(List<Pair<L,R>> list)Returns a list of the left elements of a list of pairs.static <L,R>
Iterable<L>leftIter(Iterable<Pair<L,R>> iterable)Returns an iterable over the left slice of an iterable.static <L,R>
Pair<L,R>of(L left, R right)Creates a Pair.static <L,R>
List<R>right(List<Pair<L,R>> list)Returns a list of the right elements of a list of pairs.static <L,R>
Iterable<R>rightIter(Iterable<Pair<L,R>> iterable)Returns an iterable over the right slice of an iterable.RsetValue(R value)StringtoString()
-
-
-
Method Detail
-
of
public static <L,R> Pair<L,R> of(L left, R right)
Creates a Pair.- Parameters:
left- Left valueright- Right value- Returns:
- a new Pair
-
equals
public boolean equals(Object obj)
-
hashCode
public int hashCode()
-
leftIter
public static <L,R> Iterable<L> leftIter(Iterable<Pair<L,R>> iterable)
Returns an iterable over the left slice of an iterable.- Type Parameters:
L- Left typeR- Right type- Parameters:
iterable- Iterable over pairs- Returns:
- Iterable over the left elements
-
rightIter
public static <L,R> Iterable<R> rightIter(Iterable<Pair<L,R>> iterable)
Returns an iterable over the right slice of an iterable.- Type Parameters:
L- right typeR- Right type- Parameters:
iterable- Iterable over pairs- Returns:
- Iterable over the right elements
-
left
public static <L,R> List<L> left(List<Pair<L,R>> list)
Returns a list of the left elements of a list of pairs.
-
-