-
- Type Parameters:
T- the type of entities that are contained in theStream.
- All Superinterfaces:
java.lang.Iterable<T>
- All Known Subinterfaces:
Collection<T>,Iterator<T>,List<T>,Map<K,T>,Optional<T>,Pipeline<T>,Sequence<T>,Set<T>,Traversable<T>,Tree<T>,Tree.NodeCollection<T>,Value<T>
- All Known Implementing Classes:
ValueType
public interface Streamable<T> extends java.lang.Iterable<T>This interface indicates that the class implements thestream()method. Allowing access to the Java 8 streaming API.- Since:
- 0.0.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Streamable<T>filter(java.util.function.Predicate<T> predicate)Filter out an element if it does not match the suppliedpredicate.<U> Streamable<U>map(java.util.function.Function<T,U> mapper)Perform a mapping operation on the elements in the stream.java.util.stream.Stream<T>stream()Creates aStreamto access the entities of type T contained within thisStreamableclass.
-
-
-
Method Detail
-
filter
Streamable<T> filter(java.util.function.Predicate<T> predicate)
Filter out an element if it does not match the suppliedpredicate. This operation will iterate over all elements and return a new set containing only the elements where the predicate returnstruefor.- Parameters:
predicate- the predicate to apply to the contents of this- Returns:
- the filtered value
- Throws:
java.lang.NullPointerException- ifpredicateis null
-
map
<U> Streamable<U> map(java.util.function.Function<T,U> mapper)
Perform a mapping operation on the elements in the stream.This operation will loop over all elements in the stream and apply the
mappermethod. The mapped values will be returned in as a new stream of elements.- Type Parameters:
U- the type of object expected as a result- Parameters:
mapper- the mapping functionality- Returns:
- the mapped object
-
stream
java.util.stream.Stream<T> stream()
Creates aStreamto access the entities of type T contained within thisStreamableclass.- Returns:
- the
Streamentity.
-
-