Package org.organicdesign.fp.tuple
Class Tuple4<A,B,C,D>
- java.lang.Object
-
- org.organicdesign.fp.tuple.Tuple4<A,B,C,D>
-
- All Implemented Interfaces:
Serializable
public class Tuple4<A,B,C,D> extends Object implements Serializable
Holds 4 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 fieldD
_4()
Returns the 4th fieldboolean
equals(Object other)
int
hashCode()
static <A,B,C,D>
@NotNull Tuple4<A,B,C,D>of(A a, B b, C c, D d)
Public static factory method@NotNull String
toString()
-
-
-
Constructor Detail
-
Tuple4
protected Tuple4(A a, B b, C c, D d)
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.
-
-