org.apache.tapestry5.func
Class Tuple<A,B>

java.lang.Object
  extended by org.apache.tapestry5.func.Tuple<A,B>
Type Parameters:
A -
B -

public class Tuple<A,B>
extends Object

A Tuple holds two values of two different types.

Since:
5.3

Field Summary
 A first
           
 B second
           
 
Constructor Summary
Tuple(A first, B second)
           
 
Method Summary
static
<X,Y> Tuple<X,Y>
create(X first, Y second)
           
 boolean equals(Object obj)
          Compares this Tuple to another object.
protected  void extendDescription(StringBuilder builder)
          Overriden in subclasses to write additional values into the description.
protected  boolean isMatch(Object other)
          The heart of equals(Object); the other object is the same class as this object.
 String toString()
          Returns the values of the tuple, separated by commas, enclosed in parenthesis.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

first

public final A first

second

public final B second
Constructor Detail

Tuple

public Tuple(A first,
             B second)
Method Detail

create

public static <X,Y> Tuple<X,Y> create(X first,
                                      Y second)

toString

public String toString()
Returns the values of the tuple, separated by commas, enclosed in parenthesis. Example: ("Ace", "Spades").

Overrides:
toString in class Object

extendDescription

protected void extendDescription(StringBuilder builder)
Overriden in subclasses to write additional values into the description.

Parameters:
builder -

equals

public boolean equals(Object obj)
Compares this Tuple to another object. Equality is defined by: other object is not null, is same class as this Tuple, and all values are themselves equal.

Overrides:
equals in class Object

isMatch

protected boolean isMatch(Object other)
The heart of equals(Object); the other object is the same class as this object.

Parameters:
other - other tuple to compare
Returns:
true if all values stored in tuple match


Copyright © 2003-2012 The Apache Software Foundation.