Package civitas.celestis.util.tuple
Class Long1
java.lang.Object
civitas.celestis.util.tuple.Long1
- All Implemented Interfaces:
BaseTuple<Long>,LongTuple,Serializable
A tuple with one element.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong[]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(long v) Checks if this tuple contains the provided valuev.booleancontainsAll(Iterable<Long> i) Checks if this tuple contains multiple values.booleanChecks for equality between this tuple and the provided objectobj.longget()Returns the element of this tuple.longget(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(LongFunction<? 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.
-
Field Details
-
element
protected final long elementThe element of this tuple.
-
-
Constructor Details
-
Long1
public Long1(long element) Creates a new tuple.- Parameters:
element- The element of this tuple
-
Long1
public Long1(@Nonnull long[] elements) Creates a new tuple.- Parameters:
elements- The singular array of this tuple's element- Throws:
IllegalArgumentException- When the provided array's length is not1
-
Long1
Creates a new tuple.- Parameters:
t- The tuple of which to copy elements from- Throws:
IllegalArgumentException- When the provided tuplet's size is not1
-
-
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(long v) Checks if this tuple contains the provided valuev. -
containsAll
Checks if this tuple contains multiple values.- Specified by:
containsAllin interfaceLongTuple- 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 interfaceLongTuple- Parameters:
i- The index of the element to get- Returns:
- The
ith component of this tuple - Throws:
IndexOutOfBoundsException- When the indexiis out of bounds
-
get
public long get()Returns the element of this tuple.- Returns:
- The element of this tuple
-
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 long[] 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.
-