public class StreamUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <T,R> java.util.function.Function<T,java.util.stream.Stream<R>> |
keepInstances(java.lang.Class<R> keepClazz)
Utility function that can be used to filter streams to exclude any
elements that are not instances of a particular type.
|
public static <T,R> java.util.function.Function<T,java.util.stream.Stream<R>> keepInstances(java.lang.Class<R> keepClazz)
Use the result of this method as the argument to
Stream.flatMap(java.util.function.Function<? super T, ? extends java.util.stream.Stream<? extends R>>)
.
keepClazz
- class for which instances are required