net.grinder.util
Class Pair<F,S>

java.lang.Object
  extended by net.grinder.util.Pair<F,S>
Type Parameters:
F - The type of the first item.
S - The type of the first item.

public class Pair<F,S>
extends Object

An immutable type-safe pair.

Author:
Philip Aston

Constructor Summary
protected Pair(F first, S second)
          Constructor for Pair.
 
Method Summary
 boolean equals(Object o)
          Equality.
 F getFirst()
          Accessor for the first item.
 S getSecond()
          Accessor for the second item.
 int hashCode()
          Hash code.
static
<F,S> Pair<F,S>
of(F first, S second)
          Type safe factory method.
 String toString()
          Describe ourself.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pair

protected Pair(F first,
               S second)
Constructor for Pair.

Parameters:
first - The first item.
second - The second item.
Method Detail

of

public static <F,S> Pair<F,S> of(F first,
                                 S second)
Type safe factory method.

Type Parameters:
F - The type of the first item.
S - The type of the first item.
Parameters:
first - The first item.
second - The second item.
Returns:
A pair.

getFirst

public F getFirst()
Accessor for the first item.

Returns:
The item.

getSecond

public S getSecond()
Accessor for the second item.

Returns:
The item.

hashCode

public int hashCode()
Hash code.

Overrides:
hashCode in class Object
Returns:
The hash code.

equals

public boolean equals(Object o)
Equality.

Overrides:
equals in class Object
Parameters:
o - Object to compare.
Returns:
true if and only if this object equals o.

toString

public String toString()
Describe ourself.

Overrides:
toString in class Object
Returns:
The description.


Copyright © 2000-2013. All Rights Reserved.