Package org.springframework.data.util
Interface Streamable<T>
- All Known Subinterfaces:
- Page<T>,- PersistentPropertyPath<P>,- PersistentPropertyPaths<T,,- P> - Slice<T>,- Window<T>
- All Known Implementing Classes:
- DefaultParameters,- EntityProjection,- EntityProjection.ContainerPropertyProjection,- EntityProjection.PropertyProjection,- ExpressionDependencies,- GeoPage,- PageImpl,- Parameters,- PartTree,- PartTree.OrPart,- PersistentEntities,- PropertyPath,- QSort,- RepositoryComposition.RepositoryFragments,- Revisions,- RevisionSort,- SliceImpl,- Sort,- Sort.TypedSort
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Simple interface to ease streamability of 
Iterables.- Since:
- 2.0
- Author:
- Oliver Gierke, Christoph Strobl
- 
Method SummaryModifier and TypeMethodDescriptiondefault Streamable<T>Creates a newStreamablefrom the current one and the givenIterableconcatenated.default Streamable<T>Creates a newStreamablefrom the current one and the givenStreamconcatenated.default Streamable<T>and(Streamable<? extends T> streamable) Convenience method to allow adding aStreamabledirectly as otherwise the invocation is ambiguous betweenand(Iterable)andand(Supplier).default Streamable<T>Creates a newStreamablefrom the current one and the given values concatenated.static <T> Streamable<T>empty()Returns an emptyStreamable.default Streamable<T>Returns a newStreamablethat will apply the given filterPredicateto the current one.default <R> Streamable<R>Returns a newStreamablethat will apply the givenFunctionto the current one.get()default booleanisEmpty()Returns whether the currentStreamableis empty.default <R> Streamable<R>Returns a newStreamablethat will apply the givenFunctionto the current one.static <T> Streamable<T>Returns aStreamablefor the givenIterable.static <T> Streamable<T>static <T> Streamable<T>of(T... t) Returns aStreamablewith the given elements.stream()toList()Creates a new, unmodifiableList.toSet()Creates a new, unmodifiableSet.static <S> Collector<S,?, Streamable<S>> A collector to easily produce aStreamablefrom aStreamusingCollectors.toList()as intermediate collector.static <S,T extends Iterable<S>> 
 Collector<S,?, Streamable<S>> toStreamable(Collector<S, ?, T> intermediate) A collector to easily produce aStreamablefrom aStreamand the given intermediate collector.Methods inherited from interface java.lang.IterableforEach, iterator, spliterator
- 
Method Details- 
emptyReturns an emptyStreamable.- Returns:
- will never be null.
 
- 
ofReturns aStreamablewith the given elements.- Parameters:
- t- the elements to return.
- Returns:
 
- 
ofReturns aStreamablefor the givenIterable.- Parameters:
- iterable- must not be null.
- Returns:
 
- 
of
- 
stream- Returns:
- will never be null.
 
- 
mapReturns a newStreamablethat will apply the givenFunctionto the current one.- Parameters:
- mapper- must not be null.
- Returns:
- See Also:
 
- 
flatMapReturns a newStreamablethat will apply the givenFunctionto the current one.- Parameters:
- mapper- must not be null.
- Returns:
- See Also:
 
- 
filterReturns a newStreamablethat will apply the given filterPredicateto the current one.- Parameters:
- predicate- must not be null.
- Returns:
- See Also:
 
- 
isEmptydefault boolean isEmpty()Returns whether the currentStreamableis empty.- Returns:
 
- 
andCreates a newStreamablefrom the current one and the givenStreamconcatenated.- Parameters:
- stream- must not be null.
- Returns:
- Since:
- 2.1
 
- 
andCreates a newStreamablefrom the current one and the given values concatenated.- Parameters:
- others- must not be null.
- Returns:
- will never be null.
- Since:
- 2.2
 
- 
andCreates a newStreamablefrom the current one and the givenIterableconcatenated.- Parameters:
- iterable- must not be null.
- Returns:
- will never be null.
- Since:
- 2.2
 
- 
andConvenience method to allow adding aStreamabledirectly as otherwise the invocation is ambiguous betweenand(Iterable)andand(Supplier).- Parameters:
- streamable- must not be null.
- Returns:
- will never be null.
- Since:
- 2.2
 
- 
toListCreates a new, unmodifiableList.- Returns:
- will never be null.
- Since:
- 2.2
 
- 
toSetCreates a new, unmodifiableSet.- Returns:
- will never be null.
- Since:
- 2.2
 
- 
get
- 
toStreamableA collector to easily produce aStreamablefrom aStreamusingCollectors.toList()as intermediate collector.- Returns:
- Since:
- 2.2
- See Also:
 
- 
toStreamablestatic <S,T extends Iterable<S>> Collector<S,?, toStreamableStreamable<S>> (Collector<S, ?, T> intermediate) A collector to easily produce aStreamablefrom aStreamand the given intermediate collector.- Returns:
- Since:
- 2.2
 
 
-