Package org.goplanit.utils.misc
Class Quadruple<A,B,C,D>
- java.lang.Object
-
- org.goplanit.utils.misc.Quadruple<A,B,C,D>
-
- Type Parameters:
A
- first objectB
- second objectC
- third objectD
- third object
public class Quadruple<A,B,C,D> extends Object
Custom quadruple class.- Author:
- markr
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> void
all(Consumer<T> consumer)
Apply consumer to all entries.boolean
allNotNull()
check if all values are not nullboolean
anyIsNotNull()
check if any of the values is not nullboolean
anyIsNull()
check if any values are nullQuadruple<A,B,C,D>
copy()
shallow copy of this pairboolean
equals(Object other)
Compare to another pairA
first()
Get first objectD
fourth()
Get fourth objectint
hashCode()
static <A,B,C,D>
Quadruple<A,B,C,D>of(A valueA, B valueB, C valueC, D valueD)
Factory methodB
second()
Get second objectC
third()
Get third objectString
toString()
Convert to string
-
-
-
Method Detail
-
of
public static <A,B,C,D> Quadruple<A,B,C,D> of(A valueA, B valueB, C valueC, D valueD)
Factory method- Type Parameters:
A
- type of valueAB
- type of valueBC
- type of valueCD
- type of valueD- Parameters:
valueA
- firstvalueB
- secondvalueC
- firstvalueD
- second- Returns:
- new quadruple
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classObject
- Returns:
- hashCode for this entity
- See Also:
Object.hashCode()
-
equals
public boolean equals(Object other)
Compare to another pair- Overrides:
equals
in classObject
- Parameters:
other
- pair being compared to- See Also:
Object.equals(Object)
-
toString
public String toString()
Convert to string- Overrides:
toString
in classObject
- See Also:
Object.toString()
-
first
public A first()
Get first object- Returns:
- first object
-
second
public B second()
Get second object- Returns:
- second object
-
third
public C third()
Get third object- Returns:
- third object
-
fourth
public D fourth()
Get fourth object- Returns:
- fourth object
-
anyIsNotNull
public boolean anyIsNotNull()
check if any of the values is not null- Returns:
- true when one of the entries is not null
-
allNotNull
public boolean allNotNull()
check if all values are not null- Returns:
- true when both entries are not null
-
anyIsNull
public boolean anyIsNull()
check if any values are null- Returns:
- true when any are null, false otherwise
-
all
public <T> void all(Consumer<T> consumer)
Apply consumer to all entries. Throws ClassCastException when pair contains entries not compatible with type parameter of consumer- Type Parameters:
T
- consumer type assumed to be compatible with all entries- Parameters:
consumer
- to apply
-
-