Class Array.ImmutableProjection<A>
java.lang.Object
fj.data.Array.ImmutableProjection<A>
- All Implemented Interfaces:
Iterable<A>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAppends the given array to this array.<B> Array<B> Performs function application within an array (applicative functor pattern).<B> Array<B> Binds the given function across each element of this array with a final join.Filters elements from this array by returning only elements which producetruewhen the given function is applied to them.<B> BPerforms a left-fold reduction across this array.<B> BPerforms a right-fold reduction across this array.Performs a side-effect for each element of this array.get(int index) Returns the element at the given index if it exists, fails otherwise.booleanisEmpty()Returnstrueis this array is empty,falseotherwise.booleanReturnsfalseis this array is empty,trueotherwise.iterator()Returns an iterator for this array.intlength()Returns the length of this array.<B> Array<B> Maps the given function across this array.reverse()Reverse this array in constant stack space.<B> Array<B> Performs a bind across each array element, but ignores the element value each time.Projects an immutable collection of this array.Returns an either projection of this array; the given argument inLeftif empty, or the first element inRight.toList()Returns a list projection of this array.toOption()Returns an option projection of this array;Noneif empty, or the first element inSome.toStream()Returns a stream projection of this array.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
a
-
-
Constructor Details
-
ImmutableProjection
-
-
Method Details
-
iterator
-
get
Returns the element at the given index if it exists, fails otherwise.- Parameters:
index- The index at which to get the element to return.- Returns:
- The element at the given index if it exists, fails otherwise.
-
length
public int length()Returns the length of this array.- Returns:
- The length of this array.
-
isEmpty
public boolean isEmpty()Returnstrueis this array is empty,falseotherwise.- Returns:
trueis this array is empty,falseotherwise.
-
isNotEmpty
public boolean isNotEmpty()Returnsfalseis this array is empty,trueotherwise.- Returns:
falseis this array is empty,trueotherwise.
-
toOption
-
toEither
-
toList
-
toStream
-
map
-
filter
-
foreach
-
foldRight
Performs a right-fold reduction across this array. This function uses O(length) stack space.- Parameters:
f- The function to apply on each element of the array.b- The beginning value to start the application from.- Returns:
- The final result after the right-fold reduction.
-
foldLeft
Performs a left-fold reduction across this array. This function runs in constant space.- Parameters:
f- The function to apply on each element of the array.b- The beginning value to start the application from.- Returns:
- The final result after the left-fold reduction.
-
bind
-
sequence
-
apply
-
reverse
-
append
-
toCollection
Projects an immutable collection of this array.- Returns:
- An immutable collection of this array.
-