Class IterableW<A>
java.lang.Object
fj.data.IterableW<A>
- All Implemented Interfaces:
Iterable<A>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<B> IterableW<B> Performs function application within an iterable (applicative functor pattern).arrow()Provides a transformation from a function to a Iterable-valued function that is equivalent to it.bind()The first-class bind function over Iterable.Binds the given function across the wrapped Iterable with a final join.static <A,B, C> IterableW <C> Binds the given function to the values in the given iterables with a final join.<B> BThe catamorphism for Iterables, implemented as a left fold.Takes the first 2 elements of the iterable and applies the function to them, then applies the function to the result and the third element and so on.Takes the first 2 elements of the iterable and applies the function to them, then applies the function to the result and the third element and so on.<B> BThe catamorphism for Iterables, implemented as a right fold.static <A> IterableW<A> iterable(A a) Returns an Iterable that completely preserves the argument.Wraps a given function's return value in a Iterable.iterator()Returns an iterator for this iterable.join()Returns a function that joins an Iterable of Iterables into a single Iterable.Joins an Iterable of Iterables into a single Iterable.Promotes a function of arity-2 to a function on iterables.map()Returns a function that promotes any function so that it operates on Iterables.<B> IterableW<B> Maps a given function across the wrapped Iterable.Performs a bind across each element of all iterables of an iterable, collecting the values in an iterable.Returns a java.util.List implementation for this iterable.toZipper()wrap()Provides a function that wraps the given iterable.static <A> IterableW<A> Wraps the given iterable.<B> IterableW<B> Zips this iterable with the given iterable of functions, applying each function in turn to the corresponding element in this iterable to produce a new iterable.Zips this iterable with the given iterable to produce a iterable of pairs.zipIndex()Zips this iterable with the index of its element as a pair.<B,C> Iterable <C> Zips this iterable with the given iterable using the given function to produce a new iterable.<B,C> Iterable <C> Zips this iterable with the given iterable using the given function to produce a new iterable.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
i
-
-
Constructor Details
-
IterableW
-
-
Method Details
-
wrap
-
wrap
-
iterable
Returns an Iterable that completely preserves the argument. The unit function for Iterables.- Parameters:
a- A value to preserve in an Iterable.- Returns:
- An Iterable that yields the argument when iterated over.
-
iterable
-
arrow
-
bind
-
apply
-
bind
Binds the given function to the values in the given iterables with a final join.- Parameters:
a- A given iterable to bind the given function with.b- A given iterable to bind the given function with.f- The function to apply to the values in the given iterables.- Returns:
- A new iterable after performing the map, then final join.
-
liftM2
-
sequence
Performs a bind across each element of all iterables of an iterable, collecting the values in an iterable. This implementation is strict and requires O(n) stack space.- Parameters:
as- The iterable of iterables to transform.- Returns:
- A iterable of iterables containing the results of the bind operations across all given iterables.
-
bind
-
join
-
join
-
map
-
map
-
foldLeft
-
foldLeft1
Takes the first 2 elements of the iterable and applies the function to them, then applies the function to the result and the third element and so on.- Parameters:
f- The function to apply on each element of the iterable.- Returns:
- The final result after the left-fold reduction.
-
foldLeft1
Takes the first 2 elements of the iterable and applies the function to them, then applies the function to the result and the third element and so on.- Parameters:
f- The function to apply on each element of the iterable.- Returns:
- The final result after the left-fold reduction.
-
foldRight
-
iterator
-
zapp
Zips this iterable with the given iterable of functions, applying each function in turn to the corresponding element in this iterable to produce a new iterable. The iteration is normalised so that it ends when one of the iterators is exhausted.- Parameters:
fs- The iterable of functions to apply to this iterable.- Returns:
- A new iterable with the results of applying the functions to this iterable.
-
zipWith
Zips this iterable with the given iterable using the given function to produce a new iterable. If this iterable and the given iterable have different lengths, then the longer iterable is normalised so this function never fails.- Parameters:
bs- The iterable to zip this iterable with.f- The function to zip this iterable and the given iterable with.- Returns:
- A new iterable with a length the same as the shortest of this iterable and the given iterable.
-
zipWith
Zips this iterable with the given iterable using the given function to produce a new iterable. If this iterable and the given iterable have different lengths, then the longer iterable is normalised so this function never fails.- Parameters:
bs- The iterable to zip this iterable with.f- The function to zip this iterable and the given iterable with.- Returns:
- A new iterable with a length the same as the shortest of this iterable and the given iterable.
-
zip
Zips this iterable with the given iterable to produce a iterable of pairs. If this iterable and the given iterable have different lengths, then the longer iterable is normalised so this function never fails.- Parameters:
bs- The iterable to zip this iterable with.- Returns:
- A new iterable with a length the same as the shortest of this iterable and the given iterable.
-
zipIndex
-
toStandardList
-
toZipper
-