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 fieldbooleanequals(Object other)inthashCode()static <A,B,C>
@NotNull Tuple3<A,B,C>of(A a, B b, C c)Public static factory method@NotNull StringtoString()
-
-
-
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 subtype. Therefore, you have more flexibility with a static factory as part of your public API then with a public constructor.
-
-