Interface EmptyResultIfEmptySourceCollector<T,A,R>

Type Parameters:
T - the type of input elements to the reduction operation
R - the type of value contained in the resulting Optional, if not source is empty.
All Superinterfaces:
Collector<T,A,Optional<R>>
All Known Implementing Classes:
EnforceAtMostOneElementCollector

public interface EmptyResultIfEmptySourceCollector<T,A,R> extends Collector<T,A,Optional<R>>
A collector type specific for implementations which produce an Optional based on if the source (typically a Stream, or more apropriately, a NonEmptyStream) yields no elements or any element(s). Typically appropriate for reduction operations which needs at least one element to produce a valid result.