Package civitas.celestis.util.tuple
Class IntArrayTuple
java.lang.Object
civitas.celestis.util.tuple.IntArrayTuple
- All Implemented Interfaces:
BaseTuple<Integer>,IntTuple,Serializable
An array-based tuple which holds an arbitrary element of type
int.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionIntArrayTuple(int... elements) Creates a new array tuple.Creates a new array tuple. -
Method Summary
Modifier and TypeMethodDescriptionint[]array()Returns an array containing the components of this tuple in their proper order.boxed()Returns a tuple containing the components of this tuple in their boxed form.booleancontains(int v) Checks if this tuple contains the provided valuev.booleanChecks if this tuple contains multiple values.booleanChecks for equality between this tuple and the provided objectobj.intget(int i) Returns theith component of this tuple.inthashCode()Returns the hash code of this instance.booleanisZero()Returns whether this tuple represents zero.list()Returns an unmodifiable list containing the components of this tuple in their proper order.Applies the provided mapper functionfto each component of this tuple, then returns a new tuple containing the return values of the functionf.<F> Tuple<F>mapToObj(IntFunction<? extends F> f) Applies the provided mapper functionfto each component of this tuple, then returns a new tuple containing the return values of the functionf.intsize()Returns the size of this tuple.stream()Returns a stream whose source is the elements of this tuple.toString()Serializes this tuple into a string.
-
Constructor Details
-
IntArrayTuple
public IntArrayTuple(@Nonnull int... elements) Creates a new array tuple.- Parameters:
elements- The elements this tuple should contain
-
IntArrayTuple
Creates a new array tuple.- Parameters:
t- The tuple of which to copy elements from
-
-
Method Details
-
size
public int size()Returns the size of this tuple. (the number of components it has) -
isZero
public boolean isZero()Returns whether this tuple represents zero. (whether every component is zero) -
contains
public boolean contains(int v) Checks if this tuple contains the provided valuev. -
containsAll
Checks if this tuple contains multiple values.- Specified by:
containsAllin interfaceIntTuple- Parameters:
i- The iterable object of which to check for containment- Returns:
trueif this tuple contains every component of the iterable object
-
get
Returns theith component of this tuple.- Specified by:
getin interfaceIntTuple- Parameters:
i- The index of the element to get- Returns:
- The
ith component of this tuple - Throws:
IndexOutOfBoundsException- When the indexiis out of bounds
-
map
Applies the provided mapper functionfto each component of this tuple, then returns a new tuple containing the return values of the functionf. -
mapToObj
Applies the provided mapper functionfto each component of this tuple, then returns a new tuple containing the return values of the functionf. -
array
@Nonnull public int[] array()Returns an array containing the components of this tuple in their proper order. -
stream
Returns a stream whose source is the elements of this tuple. -
list
Returns an unmodifiable list containing the components of this tuple in their proper order. -
boxed
Returns a tuple containing the components of this tuple in their boxed form. -
equals
Checks for equality between this tuple and the provided objectobj. -
toString
Serializes this tuple into a string. -
hashCode
public int hashCode()Returns the hash code of this instance.
-