Package org.opencastproject.util.data
Class Monadics.ListMonadic<A>
java.lang.Object
org.opencastproject.util.data.Monadics.ListMonadic<A>
- All Implemented Interfaces:
Iterable<A>
- Enclosing class:
Monadics
The list monad.
-
Method Summary
Modifier and TypeMethodDescriptionabstract <B> Monadics.ListMonadic<B> Monadic bindm a -> (a -> m b) -> m b.abstract <M extends Iterable<A>>
Monadics.ListMonadic<A> concat(M m) Appendato the list.abstract <X extends A>
Monadics.ListMonadic<A> cons(X a) Construct a new list by prependinga.abstract Monadics.ListMonadic<A> drop(int n) Drop the firstnelements of the list.abstract Monadics.ListMonadic<A> Apply side effecteto each element.abstract booleanCheck if at least one element satisfies predicatep.abstract Monadics.ListMonadic<A> Retain all elements satisfying predicatep.Return the first element satisfying predicatep.final <B> Monadics.ListMonadic<B> Alias forbind(Function).abstract <B> Monadics.ListMonadic<B> Applyfto each elements building a new list.abstract <B> BFold the list from left to right applying binary operatorfstarting withzero.headOpt()Return the head of the list.final <B> Monadics.ListMonadic<B> Alias forfmap.abstract Stringabstract AReduce the list from left to right applying binary operatorf.abstract Monadics.ListMonadic<A> sort(Comparator<A> c) abstract Monadics.ListMonadic<A> take(int n) Limit the list to the firstnelements.value()Return the wrapped, unmodifiable list.abstract <B,M extends Iterable<B>>
Monadics.ListMonadic<Tuple<A, B>> zip(M bs) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
map
Alias forfmap. -
fmap
Applyfto each elements building a new list. This is the list functor.- See Also:
-
flatMap
Alias forbind(Function). -
bind
Monadic bindm a -> (a -> m b) -> m b. Applyfto each elements concatenating the results into a new list. -
foldl
Fold the list from left to right applying binary operatorfstarting withzero. -
reducel
Reduce the list from left to right applying binary operatorf. The list must not be empty. -
concat
Appendato the list. -
cons
Construct a new list by prependinga. -
filter
Retain all elements satisfying predicatep. -
find
Return the first element satisfying predicatep. -
exists
Check if at least one element satisfies predicatep. -
each
Apply side effecteto each element. -
zip
-
sort
-
headOpt
Return the head of the list. -
take
Limit the list to the firstnelements. -
drop
Drop the firstnelements of the list. -
mkString
-
value
Return the wrapped, unmodifiable list.
-