Interface Streamable<E>
- Type Parameters:
E- The type of contained elements.
- All Known Subinterfaces:
Streamer<E>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents instances that (virtually or really) contain elements of a specific type
and can provide a
Stream over those elements when needed.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanReturnstrueif thisStreamablecontains at least one element such thatObjects.equals(element, candidate).default <X> booleancontainsAll(Streamable<X> other) default booleancontainsAll(Predicate<? super E> condition) Returnstrueif thisStreamablecontains elements such that condition.test(element)istruefor each element.default booleanReturnstrueif thisStreamablecontains any element.default <X> booleancontainsAny(Streamable<X> other) default booleancontainsAny(Predicate<? super E> condition) Returnstrueif thisStreamablecontains at least one element such that condition.test(element)istrue.static <E> Streamable<E>empty()Returns aStreamablethat is empty.default voidPerforms the given action for each element of thisStreamableuntil all elements have been processed or the action throws an (unchecked) exception.default booleanisEmpty()Returnstrueif thisStreamablecontains no element.static <E> Streamable<E>of(E element) Returns aStreamablethat contains a single given element.static <E> Streamable<E>of(E[] elements) Returns aStreamablebacked by an array of elements.static <E> Streamable<E>of(E element0, E element1, E... more) Returns aStreamablethat contains two or more given elements.static <E> Streamable<E>Returns aStreamablebacked by a givenIterable.stream()Returns a sequentialStreamwith thisStreamableas its source.
-
Method Details
-
empty
Returns aStreamablethat is empty.- Type Parameters:
E- The type of virtually contained elements.
-
of
Returns aStreamablethat contains a single given element.- Type Parameters:
E- The type of the contained element.
-
of
Returns aStreamablethat contains two or more given elements.- Type Parameters:
E- The type of the contained elements.
-
of
Returns aStreamablebacked by an array of elements.- Type Parameters:
E- The type of the contained elements.
-
of
Returns aStreamablebacked by a givenIterable.- Type Parameters:
E- The type of the contained elements.
-
stream
Returns a sequentialStreamwith thisStreamableas its source.An implementation may or may not specify a streaming order.
-
isEmpty
default boolean isEmpty()Returnstrueif thisStreamablecontains no element. -
containsAny
default boolean containsAny()Returnstrueif thisStreamablecontains any element. -
containsAny
Returnstrueif thisStreamablecontains at least one element such that condition.test(element)istrue.- Throws:
NullPointerException- if the specified condition isnull.
-
containsAll
Returnstrueif thisStreamablecontains elements such that condition.test(element)istruefor each element.- Throws:
NullPointerException- if the specified condition isnull.
-
contains
Returnstrueif thisStreamablecontains at least one element such thatObjects.equals(element, candidate). -
containsAny
- Throws:
NullPointerException- if the specified otherStreamableisnull.
-
containsAll
- Throws:
NullPointerException- if the specified otherStreamableisnull.
-
forEach
Performs the given action for each element of thisStreamableuntil all elements have been processed or the action throws an (unchecked) exception. Actions are performed in the streaming order, if that order is specified. Exceptions thrown by the action are relayed to the caller.- Throws:
NullPointerException- if the specified action isnull.
-