Package org.midheaven.collections
Interface Traversable<T>
- Type Parameters:
T- type of the elements in the Traversable
- All Superinterfaces:
AutoCloseable,Iterable<T>
Defines the contract for Traversable.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Performs close.default <R,A> R Performs collect.default Traversable<T> concat(Traversable<T> other) Performs concat.static <S> Traversable<S> empty()Returns an empty instance.default <R> Traversable<R> flatMap(Function<T, Traversable<R>> mapper) Performs flatMap.static <S> Traversable<S> Creates an instance from the provided source.static <S> Traversable<S> Creates an instance from the provided source.static <S> Traversable<S> from(Enumerable<S> enumerable) Creates an instance from the provided source.static <S> Traversable<S> from(S first, S... others) Creates an instance from the provided source.default <R> Traversable<R> Performs map.default <O,R> Traversable <R> zip(Traversable<O> other, BiFunction<T, O, R> zipper) Performs zip.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
empty
Returns an empty instance.- Returns:
- the result of empty
-
from
Creates an instance from the provided source.- Parameters:
iterable- the iterable value- Returns:
- the result of from
-
from
Creates an instance from the provided source.- Parameters:
first- the first valueothers- the others value- Returns:
- the result of from
-
from
Creates an instance from the provided source.- Parameters:
enumerable- the enumerable value- Returns:
- the result of from
-
from
Creates an instance from the provided source.- Parameters:
stream- the stream value- Returns:
- the result of from
-
map
Performs map.- Parameters:
mapper- the mapper value- Returns:
- the result of map
-
flatMap
Performs flatMap.- Parameters:
mapper- the mapper value- Returns:
- the result of flatMap
-
concat
Performs concat.- Parameters:
other- the other value- Returns:
- the result of concat
-
zip
Performs zip.- Parameters:
other- the other valuezipper- the zipper value- Returns:
- the result of zip
-
collect
Performs collect.- Parameters:
collector- the collector value- Returns:
- the result of collect
-
close
void close()Performs close.- Specified by:
closein interfaceAutoCloseable
-