mondrian.util
Class Pair<L,R>

java.lang.Object
  extended by mondrian.util.Pair<L,R>
All Implemented Interfaces:
java.lang.Comparable<Pair<L,R>>, java.util.Map.Entry<L,R>

public class Pair<L,R>
extends java.lang.Object
implements java.lang.Comparable<Pair<L,R>>, java.util.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
Version:
$Id: //open/mondrian/src/main/mondrian/util/Pair.java#5 $
Author:
jhyde

Field Summary
 L left
           
 R right
           
 
Constructor Summary
Pair(L left, R right)
          Creates a pair.
Pair(java.util.Map.Entry<? extends L,? extends R> entry)
          Creates a pair representing the same mapping as the specified entry.
 
Method Summary
 int compareTo(Pair<L,R> that)
           
 boolean equals(java.lang.Object obj)
           
 L getKey()
           
 R getValue()
           
 int hashCode()
           
 R setValue(R value)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

left

public L left

right

public R right
Constructor Detail

Pair

public Pair(L left,
            R right)
Creates a pair.

Parameters:
left - Left value
right - Right value

Pair

public Pair(java.util.Map.Entry<? extends L,? extends R> entry)
Creates a pair representing the same mapping as the specified entry.

Parameters:
entry - the entry to copy
Method Detail

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in interface java.util.Map.Entry<L,R>
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Map.Entry<L,R>
Overrides:
hashCode in class java.lang.Object

compareTo

public int compareTo(Pair<L,R> that)
Specified by:
compareTo in interface java.lang.Comparable<Pair<L,R>>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getKey

public L getKey()
Specified by:
getKey in interface java.util.Map.Entry<L,R>

getValue

public R getValue()
Specified by:
getValue in interface java.util.Map.Entry<L,R>

setValue

public R setValue(R value)
Specified by:
setValue in interface java.util.Map.Entry<L,R>

Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads