javautils
Class ImmutablePair

java.lang.Object
  |
  +--javautils.ImmutablePair
All Implemented Interfaces:
java.util.Map.Entry
Direct Known Subclasses:
BasicEdge

public class ImmutablePair
extends java.lang.Object
implements java.util.Map.Entry

A simple immutable pair of objects.


Field Summary
 java.lang.Object first
          Immutable field of the pair.
 java.lang.Object second
          Immutable field of the pair.
 
Constructor Summary
ImmutablePair(boolean f, boolean s)
           
ImmutablePair(boolean f, byte s)
           
ImmutablePair(boolean f, char s)
           
ImmutablePair(boolean f, double s)
           
ImmutablePair(boolean f, float s)
           
ImmutablePair(boolean f, int s)
           
ImmutablePair(boolean f, long s)
           
ImmutablePair(boolean f, java.lang.Object s)
           
ImmutablePair(boolean f, short s)
           
ImmutablePair(byte f, boolean s)
           
ImmutablePair(byte f, byte s)
           
ImmutablePair(byte f, char s)
           
ImmutablePair(byte f, double s)
           
ImmutablePair(byte f, float s)
           
ImmutablePair(byte f, int s)
           
ImmutablePair(byte f, long s)
           
ImmutablePair(byte f, java.lang.Object s)
           
ImmutablePair(byte f, short s)
           
ImmutablePair(char f, boolean s)
           
ImmutablePair(char f, byte s)
           
ImmutablePair(char f, char s)
           
ImmutablePair(char f, double s)
           
ImmutablePair(char f, float s)
           
ImmutablePair(char f, int s)
           
ImmutablePair(char f, long s)
           
ImmutablePair(char f, java.lang.Object s)
           
ImmutablePair(char f, short s)
           
ImmutablePair(double f, boolean s)
           
ImmutablePair(double f, byte s)
           
ImmutablePair(double f, char s)
           
ImmutablePair(double f, double s)
           
ImmutablePair(double f, float s)
           
ImmutablePair(double f, int s)
           
ImmutablePair(double f, long s)
           
ImmutablePair(double f, java.lang.Object s)
           
ImmutablePair(double f, short s)
           
ImmutablePair(float f, boolean s)
           
ImmutablePair(float f, byte s)
           
ImmutablePair(float f, char s)
           
ImmutablePair(float f, double s)
           
ImmutablePair(float f, float s)
           
ImmutablePair(float f, int s)
           
ImmutablePair(float f, long s)
           
ImmutablePair(float f, java.lang.Object s)
           
ImmutablePair(float f, short s)
           
ImmutablePair(int f, boolean s)
           
ImmutablePair(int f, byte s)
           
ImmutablePair(int f, char s)
           
ImmutablePair(int f, double s)
           
ImmutablePair(int f, float s)
           
ImmutablePair(int f, int s)
           
ImmutablePair(int f, long s)
           
ImmutablePair(int f, java.lang.Object s)
           
ImmutablePair(int f, short s)
           
ImmutablePair(long f, boolean s)
           
ImmutablePair(long f, byte s)
           
ImmutablePair(long f, char s)
           
ImmutablePair(long f, double s)
           
ImmutablePair(long f, float s)
           
ImmutablePair(long f, int s)
           
ImmutablePair(long f, long s)
           
ImmutablePair(long f, java.lang.Object s)
           
ImmutablePair(long f, short s)
           
ImmutablePair(java.lang.Object f, boolean s)
           
ImmutablePair(java.lang.Object f, byte s)
           
ImmutablePair(java.lang.Object f, char s)
           
ImmutablePair(java.lang.Object f, double s)
           
ImmutablePair(java.lang.Object f, float s)
           
ImmutablePair(java.lang.Object f, int s)
           
ImmutablePair(java.lang.Object f, long s)
           
ImmutablePair(java.lang.Object f, java.lang.Object s)
           
ImmutablePair(java.lang.Object f, short s)
           
ImmutablePair(short f, boolean s)
           
ImmutablePair(short f, byte s)
           
ImmutablePair(short f, char s)
           
ImmutablePair(short f, double s)
           
ImmutablePair(short f, float s)
           
ImmutablePair(short f, int s)
           
ImmutablePair(short f, long s)
           
ImmutablePair(short f, java.lang.Object s)
           
ImmutablePair(short f, short s)
           
 
Method Summary
 boolean equals(java.lang.Object other)
          True if and only if the other object is not-null and this and the other object have the same class and the first fields of this and the other pair are both null or both equal and the second fields of this and the other pair are both null or both equal.
 java.lang.Object firstOfFirst()
           
 java.lang.Object firstOfSecond()
           
 java.lang.Object getKey()
          The first.
 java.lang.Object getValue()
          The second.
 int hashCode()
          The hashCode is designed to be asymmetric, so that generally new ImmutablePair(a,b) !
 java.lang.Object secondOfFirst()
           
 java.lang.Object secondOfSecond()
           
 java.lang.Object setValue(java.lang.Object value)
           throw new UnsupportedOperationException();
 ImmutablePair swap()
          A new immutable pair with the first and second swapped.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

first

public final java.lang.Object first

Immutable field of the pair.


second

public final java.lang.Object second

Immutable field of the pair.

Constructor Detail

ImmutablePair

public ImmutablePair(java.lang.Object f,
                     java.lang.Object s)

ImmutablePair

public ImmutablePair(java.lang.Object f,
                     boolean s)

ImmutablePair

public ImmutablePair(java.lang.Object f,
                     byte s)

ImmutablePair

public ImmutablePair(java.lang.Object f,
                     char s)

ImmutablePair

public ImmutablePair(java.lang.Object f,
                     double s)

ImmutablePair

public ImmutablePair(java.lang.Object f,
                     float s)

ImmutablePair

public ImmutablePair(java.lang.Object f,
                     int s)

ImmutablePair

public ImmutablePair(java.lang.Object f,
                     long s)

ImmutablePair

public ImmutablePair(java.lang.Object f,
                     short s)

ImmutablePair

public ImmutablePair(boolean f,
                     java.lang.Object s)

ImmutablePair

public ImmutablePair(boolean f,
                     boolean s)

ImmutablePair

public ImmutablePair(boolean f,
                     byte s)

ImmutablePair

public ImmutablePair(boolean f,
                     char s)

ImmutablePair

public ImmutablePair(boolean f,
                     double s)

ImmutablePair

public ImmutablePair(boolean f,
                     float s)

ImmutablePair

public ImmutablePair(boolean f,
                     int s)

ImmutablePair

public ImmutablePair(boolean f,
                     long s)

ImmutablePair

public ImmutablePair(boolean f,
                     short s)

ImmutablePair

public ImmutablePair(byte f,
                     java.lang.Object s)

ImmutablePair

public ImmutablePair(byte f,
                     boolean s)

ImmutablePair

public ImmutablePair(byte f,
                     byte s)

ImmutablePair

public ImmutablePair(byte f,
                     char s)

ImmutablePair

public ImmutablePair(byte f,
                     double s)

ImmutablePair

public ImmutablePair(byte f,
                     float s)

ImmutablePair

public ImmutablePair(byte f,
                     int s)

ImmutablePair

public ImmutablePair(byte f,
                     long s)

ImmutablePair

public ImmutablePair(byte f,
                     short s)

ImmutablePair

public ImmutablePair(char f,
                     java.lang.Object s)

ImmutablePair

public ImmutablePair(char f,
                     boolean s)

ImmutablePair

public ImmutablePair(char f,
                     byte s)

ImmutablePair

public ImmutablePair(char f,
                     char s)

ImmutablePair

public ImmutablePair(char f,
                     double s)

ImmutablePair

public ImmutablePair(char f,
                     float s)

ImmutablePair

public ImmutablePair(char f,
                     int s)

ImmutablePair

public ImmutablePair(char f,
                     long s)

ImmutablePair

public ImmutablePair(char f,
                     short s)

ImmutablePair

public ImmutablePair(double f,
                     java.lang.Object s)

ImmutablePair

public ImmutablePair(double f,
                     boolean s)

ImmutablePair

public ImmutablePair(double f,
                     byte s)

ImmutablePair

public ImmutablePair(double f,
                     char s)

ImmutablePair

public ImmutablePair(double f,
                     double s)

ImmutablePair

public ImmutablePair(double f,
                     float s)

ImmutablePair

public ImmutablePair(double f,
                     int s)

ImmutablePair

public ImmutablePair(double f,
                     long s)

ImmutablePair

public ImmutablePair(double f,
                     short s)

ImmutablePair

public ImmutablePair(float f,
                     java.lang.Object s)

ImmutablePair

public ImmutablePair(float f,
                     boolean s)

ImmutablePair

public ImmutablePair(float f,
                     byte s)

ImmutablePair

public ImmutablePair(float f,
                     char s)

ImmutablePair

public ImmutablePair(float f,
                     double s)

ImmutablePair

public ImmutablePair(float f,
                     float s)

ImmutablePair

public ImmutablePair(float f,
                     int s)

ImmutablePair

public ImmutablePair(float f,
                     long s)

ImmutablePair

public ImmutablePair(float f,
                     short s)

ImmutablePair

public ImmutablePair(int f,
                     java.lang.Object s)

ImmutablePair

public ImmutablePair(int f,
                     boolean s)

ImmutablePair

public ImmutablePair(int f,
                     byte s)

ImmutablePair

public ImmutablePair(int f,
                     char s)

ImmutablePair

public ImmutablePair(int f,
                     double s)

ImmutablePair

public ImmutablePair(int f,
                     float s)

ImmutablePair

public ImmutablePair(int f,
                     int s)

ImmutablePair

public ImmutablePair(int f,
                     long s)

ImmutablePair

public ImmutablePair(int f,
                     short s)

ImmutablePair

public ImmutablePair(long f,
                     java.lang.Object s)

ImmutablePair

public ImmutablePair(long f,
                     boolean s)

ImmutablePair

public ImmutablePair(long f,
                     byte s)

ImmutablePair

public ImmutablePair(long f,
                     char s)

ImmutablePair

public ImmutablePair(long f,
                     double s)

ImmutablePair

public ImmutablePair(long f,
                     float s)

ImmutablePair

public ImmutablePair(long f,
                     int s)

ImmutablePair

public ImmutablePair(long f,
                     long s)

ImmutablePair

public ImmutablePair(long f,
                     short s)

ImmutablePair

public ImmutablePair(short f,
                     java.lang.Object s)

ImmutablePair

public ImmutablePair(short f,
                     boolean s)

ImmutablePair

public ImmutablePair(short f,
                     byte s)

ImmutablePair

public ImmutablePair(short f,
                     char s)

ImmutablePair

public ImmutablePair(short f,
                     double s)

ImmutablePair

public ImmutablePair(short f,
                     float s)

ImmutablePair

public ImmutablePair(short f,
                     int s)

ImmutablePair

public ImmutablePair(short f,
                     long s)

ImmutablePair

public ImmutablePair(short f,
                     short s)
Method Detail

swap

public ImmutablePair swap()

A new immutable pair with the first and second swapped.


getKey

public final java.lang.Object getKey()

The first.

Specified by:
getKey in interface java.util.Map.Entry

getValue

public final java.lang.Object getValue()

The second.

Specified by:
getValue in interface java.util.Map.Entry

setValue

public final java.lang.Object setValue(java.lang.Object value)
 throw new UnsupportedOperationException();
 

Specified by:
setValue in interface java.util.Map.Entry

hashCode

public int hashCode()

The hashCode is designed to be asymmetric, so that generally new ImmutablePair(a,b) != new ImmutablePair(b,a).

Specified by:
hashCode in interface java.util.Map.Entry
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object other)

True if and only if

Specified by:
equals in interface java.util.Map.Entry
Overrides:
equals in class java.lang.Object

toString

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

firstOfFirst

public final java.lang.Object firstOfFirst()

secondOfFirst

public final java.lang.Object secondOfFirst()

firstOfSecond

public final java.lang.Object firstOfSecond()

secondOfSecond

public final java.lang.Object secondOfSecond()