Package com.yahoo.collections
Class Tuple2<T1,T2>
java.lang.Object
com.yahoo.collections.Tuple2<T1,T2>
A pair of values.
This class is to avoid littering a class with thin wrapper objects for
passing around e.g. the state of an operation and the result value. Using
this class may be correct, but it is a symptom that you may want to redesign
your code. (Should you pass mutable objects to the method instead? Create a
new class and do the work inside that class instead? Etc.)
- Author:
- Steinar Knutsen
-
Field Summary
-
Constructor Summary
-
Method Summary
-
Field Details
-
first
-
second
-
-
Constructor Details
-
Tuple2
-
-
Method Details
-
hashCode
public int hashCode()hashCode() will always throw UnsupportedOperationException. The reason is this class is not meant for being put in Container implementation or similar use where Java generics will lead to a type unsafe maintenance nightmare.- Overrides:
hashCode
in classObject
- Throws:
UnsupportedOperationException
- will always throw this when invoked
-
equals
equals(Object) will always throw UnsupportedOperationException. The intention is always using the objects contained in the tuple directly.- Overrides:
equals
in classObject
- Parameters:
obj
- ignored- Throws:
UnsupportedOperationException
- will always throw this when invoked
-
toString
Human readable string representation which invokes the contained instances' toString() implementation.
-