SoftNet-Consult Java Utility Library

com.softnetConsult.utils.collections
Class Pair<T1,T2>

java.lang.Object
  extended by com.softnetConsult.utils.collections.Pair<T1,T2>
Type Parameters:
T1 - Type of the first object of this Pair.
T2 - Type of the second object of this Pair.

public class Pair<T1,T2>
extends java.lang.Object

A convenience memory structure to hold two objects.

This product includes software developed by the SoftNet-Consult Java Utility Library project and its contributors.
(http://java-tools.sourceforge.net)
Copyright (c) 2007-2008 SoftNet-Consult.
Copyright (c) 2007-2008 G. Paperin.
All rights reserved.

File: Pair.java
Library API version: "2.02"
Java compliance version: "1.5"

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following terms and conditions are met:

1. Redistributions of source code must retain the above acknowledgement of the SoftNet-Consult Java Utility Library project, the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above acknowledgement of the SoftNet-Consult Java Utility Library project, the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software or any derived software must display the following acknowledgement:
This product includes software developed by the SoftNet-Consult Java Utility Library project and its contributors.

THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version:
"2.02"
Author:
Greg Paperin (http://www.paperin.org)

Field Summary
 T1 elem1
          The first object of this Pair.
 T2 elem2
          The second object of this Pair.
 
Constructor Summary
Pair(T1 elem1, T2 elem2)
          Creates a new pair of the specified objects.
 
Method Summary
 boolean equals(java.lang.Object o)
          Returns whether this Pair is equal to a specified object.
 boolean equals(Pair<?,?> p)
          Returns whether this Pair is equal to a specified Pair.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elem1

public T1 elem1
The first object of this Pair.


elem2

public T2 elem2
The second object of this Pair.

Constructor Detail

Pair

public Pair(T1 elem1,
            T2 elem2)
Creates a new pair of the specified objects. null objects are permitted.

Parameters:
elem1 - The first object for this Pair.
elem2 - The second object for this Pair.
Method Detail

equals

public boolean equals(java.lang.Object o)
Returns whether this Pair is equal to a specified object. A Pair p is equal to an object o if and only if o is of class (of subclass of) Pair and p.equals((Pair<?, ?>) o) returns true.

Overrides:
equals in class java.lang.Object
Returns:
true if this Pair is equal to the specified object, false otherwise.
See Also:
equals(Pair)

equals

public boolean equals(Pair<?,?> p)
Returns whether this Pair is equal to a specified Pair. Two Pairs are equal if and only if their first and second objects are both respectively equal. The first (or second) objects of two Pairs are equal if they are both null or if they are equal in respect to their respective equals methods.

Parameters:
p - A Pair to which the equality must be veryfied
Returns:
true if this Pair is equal to the specified Pair, false otherwise.

SoftNet-Consult Java Utility Library is a member of SourceForge.net