Package org.organicdesign.fp.tuple
Class Tuple3<A,B,C>
- java.lang.Object
-
- org.organicdesign.fp.tuple.Tuple3<A,B,C>
-
- All Implemented Interfaces:
Serializable
public class Tuple3<A,B,C> extends Object implements Serializable
Holds 3 items of potentially different types. Designed to let you easily create immutable subclasses (to give your data structures meaningful names) with correct equals(), hashCode(), and toString() methods.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description A
_1()
Returns the 1st fieldB
_2()
Returns the 2nd fieldC
_3()
Returns the 3rd fieldboolean
equals(Object other)
int
hashCode()
static <A,B,C>
Tuple3<A,B,C>of(A a, B b, C c)
Public static factory methodString
toString()
-
-
-
Constructor Detail
-
Tuple3
protected Tuple3(A a, B b, C c)
Constructor is protected (not public) for easy inheritance. Josh Bloch's "Item 1" says public static factory methods are better than constructors because they have names, they can return an existing object instead of a new one, and they can return a sub-type. Therefore, you have more flexibility with a static factory as part of your public API then with a public constructor.
-
-