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>
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()
and
compareTo(Pair)
, it can be used in any kind of
Collection
.
- Since:
- Apr 19, 2007
- Author:
- jhyde
-
-
Constructor Summary |
Pair(L left,
R right)
Creates a pair. |
Pair(Map.Entry<? extends L,? extends R> entry)
Creates a pair representing the same mapping as the
specified entry. |
left
public L left
right
public R right
Pair
public Pair(L left,
R right)
- Creates a pair.
- Parameters:
left
- Left valueright
- Right value
Pair
public Pair(Map.Entry<? extends L,? extends R> entry)
- Creates a pair representing the same mapping as the
specified entry.
- Parameters:
entry
- the entry to copy
equals
public boolean equals(Object obj)
- Specified by:
equals
in interface Map.Entry<L,R>
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Specified by:
hashCode
in interface Map.Entry<L,R>
- Overrides:
hashCode
in class Object
compareTo
public int compareTo(Pair<L,R> that)
- Specified by:
compareTo
in interface Comparable<Pair<L,R>>
toString
public String toString()
- Overrides:
toString
in class Object
getKey
public L getKey()
- Specified by:
getKey
in interface Map.Entry<L,R>
getValue
public R getValue()
- Specified by:
getValue
in interface Map.Entry<L,R>
setValue
public R setValue(R value)
- Specified by:
setValue
in interface Map.Entry<L,R>