Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


oracle.javatools.util
Class Pair<A,B>

java.lang.Object
  extended by oracle.javatools.util.Pair<A,B>

All Implemented Interfaces:
java.lang.Comparable<Pair<A,?>>
Direct Known Subclasses:
Pair

public class Pair<A,B>
extends java.lang.Object
implements java.lang.Comparable<Pair<A,?>>

Encapsulates a Pair of objects.
Note: The toString() method returns the toString() of the first object. This allows for example to easily attach data to a JList object by passing a Pair("Label", myObject).


Field Summary
 A first
           
 B second
           

 

Constructor Summary
Pair()
          Default constructor
Pair(A firstObj, B secondObj)
          Default constructor
Pair(Pair<A,B> pair)
          Cloning Constructor

 

Method Summary
 int compareTo(Pair<A,?> o)
          implements Comparable on the first element only.
 boolean equals(java.lang.Object obj)
           
 A getFirst()
           
 B getSecond()
           
 int hashCode()
           
 void setFirst(A firstObj)
           
 void setSecond(B secondObj)
           
 java.lang.String toString()
           

 

Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

 

Field Detail

first

public A first

second

public B second

Constructor Detail

Pair

public Pair()
Default constructor

Pair

public Pair(A firstObj,
            B secondObj)
Default constructor

Pair

public Pair(Pair<A,B> pair)
Cloning Constructor

Method Detail

setFirst

public void setFirst(A firstObj)

getFirst

public A getFirst()

setSecond

public void setSecond(B secondObj)

getSecond

public B getSecond()

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
the toString of the 'first' object or the String "&ltnull&gt" if the first object is null.

compareTo

public int compareTo(Pair<A,?> o)
implements Comparable on the first element only.
Specified by:
compareTo in interface java.lang.Comparable<Pair<A,?>>

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


Copyright © 1997, 2012, Oracle. All rights reserved.