org.mulgara.util
Class Pair<A,B>

java.lang.Object
  extended by org.mulgara.util.Pair<A,B>
All Implemented Interfaces:
Map.Entry<A,B>
Direct Known Subclasses:
PropertyValue

public class Pair<A,B>
extends Object
implements Map.Entry<A,B>

A pair of values representing a first/second pair


Field Summary
 A _1
          The first.
 B _2
          The second.
 
Constructor Summary
Pair(A a, B b)
          Create a new first/value pair.
 
Method Summary
 boolean equals(Object o)
          Equality method.
 A getFirst()
          Gets the first
 A getKey()
          Synonym for getFirst
 B getSecond()
          Synonym for getValue
 B getValue()
          Gets the value
 int hashCode()
          The hashcode, based on the first and second.
 B setValue(B b)
          Setting the value is not supported.
 String toString()
          Represents this node as a string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_1

public final A _1
The first.


_2

public final B _2
The second.

Constructor Detail

Pair

public Pair(A a,
            B b)
Create a new first/value pair.

Parameters:
a - The first part of the pair.
b - The second part of the pair.
Method Detail

getFirst

public A getFirst()
Gets the first


getKey

public A getKey()
Synonym for getFirst

Specified by:
getKey in interface Map.Entry<A,B>

getValue

public B getValue()
Gets the value

Specified by:
getValue in interface Map.Entry<A,B>

getSecond

public B getSecond()
Synonym for getValue


setValue

public B setValue(B b)
Setting the value is not supported.

Specified by:
setValue in interface Map.Entry<A,B>

equals

public boolean equals(Object o)
Equality method. Based on the wrapped URI.

Specified by:
equals in interface Map.Entry<A,B>
Overrides:
equals in class Object

hashCode

public int hashCode()
The hashcode, based on the first and second.

Specified by:
hashCode in interface Map.Entry<A,B>
Overrides:
hashCode in class Object

toString

public String toString()
Represents this node as a string.

Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.