Type Parameters:
K
- The type of Object allowed for the first Object in the tuple.
V
- The type of Object allowed for the second Object in the tuple.
public class Tuple<K,V>
extends Object
Simple implementation of a Tuple. A Tuple is an immutable paired 2-set of values (e.g. (x, y)), and may consist of
any two Objects (may be in the same class or a different class).
Author:
Fastily
Field Summary
Fields
Modifier and Type
Field
Description
K
x
The x value of the tuple
V
y
The y value of the tuple
Constructor Summary
Constructors
Constructor
Description
Tuple (K x,
V y)
Creates a Tuple from the parameter values.
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method
Description
boolean
equals (Object o)
Determines if two tuples are equal.
int
hashCode ()
Gets a hashcode for this object.
String
toString ()
Gets a String representation of this object.
Constructor Details
Creates a Tuple from the parameter values.
Parameters:
x
- The x value of the tuple
y
- The y value of the tuple
Method Details
Gets a String representation of this object. Nice for debugging.
Overrides:
toString
in class Object
public int hashCode ()
Gets a hashcode for this object. Good for mapping constructs.
Overrides:
hashCode
in class Object
public boolean equals (
Object o)
Determines if two tuples are equal. Equal tuples have the same two elements in the same order.
Overrides:
equals
in class Object