hudson.plugins.checkstyle.util
Class Pair<H,T>

java.lang.Object
  extended by hudson.plugins.checkstyle.util.Pair<H,T>
Type Parameters:
H - Type of the head
T - Type of the tail

public final class Pair<H,T>
extends java.lang.Object

Pair is a helper class for the frequent case, when two objects must be combined for a collection entry or even a key. The concept of a pair is fundamental for all languages derived from LISP and is even useful in a language like Java.

Note: Pairs may be used as keys for a hash collection, when both elements, named head and tail, implements the hashing protocol.


Constructor Summary
Pair(H head, T tail)
          Constructs a Pair using the two given objects as head and tail.
 
Method Summary
 boolean equals(java.lang.Object other)
          
 H getHead()
          Returns the head object of the pair.
 T getTail()
          Returns the tail object of the pair.
 int hashCode()
          
 void setHead(H newHead)
          Modifies the head object of the pair.
 void setTail(T newTail)
          Modifies the tail object of the pair.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pair

public Pair(H head,
            T tail)
Constructs a Pair using the two given objects as head and tail.

Parameters:
head - the object to be used as the head of the pair
tail - the object to be used as the tail of the pair
Method Detail

getHead

public H getHead()
Returns the head object of the pair.

Returns:
the head object of the pair
See Also:
setHead(H), getTail()

setHead

public void setHead(H newHead)
Modifies the head object of the pair.

Parameters:
newHead - the new head object of the pair
See Also:
getHead()

getTail

public T getTail()
Returns the tail object of the pair.

Returns:
the tail object of the pair
See Also:
setTail(T), getHead()

setTail

public void setTail(T newTail)
Modifies the tail object of the pair.

Parameters:
newTail - new tail object of the pair
See Also:
getTail()

equals

public boolean equals(java.lang.Object other)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object


Copyright © 2009. All Rights Reserved.