Please note that the specifications and other information contained herein are not final and are subject to change. The information is being made available to you solely for purpose of evaluation.
Java™ Platform
Standard Ed. 8

DRAFT ea-b00
compact1, compact2, compact3
java.util.stream

Interface Collector<T,R>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method and Description
      BiFunction<R,T,R> accumulator() 
      BinaryOperator<R> combiner()
      A function that accepts two result containers and combines their states.
      default boolean isConcurrent()
      Indicates that this collector is concurrent, meaning that the result container can support the accumulator function being called concurrently with the same result container from multiple threads.
      default boolean isStable()
      Indicates that this collector is stable, meaning that the accumulator function always returns the result container passed in as its first argument.
      Supplier<R> resultSupplier()
      A function that creates and return a new result that represents "no values".
    • Method Detail

      • resultSupplier

        Supplier<R> resultSupplier()
        A function that creates and return a new result that represents "no values". If the accumulator or combiner functions may mutate their arguments, this must be a new, empty result container.
        Returns:
        A function which, when invoked, returns a result representing "no values"
      • accumulator

        BiFunction<R,T,R> accumulator()
        Returns:
        A function which, when invoked with a result container and a value, modifies the state of the reslut container to reflect incorporation of the new value MUST either mutate and return same, or NOT mutate
      • combiner

        BinaryOperator<R> combiner()
        A function that accepts two result containers and combines their states. It may return a new container, or may merge the state of one container into the other, and return the modified container.
        Returns:
      • isConcurrent

        default boolean isConcurrent()
        Indicates that this collector is concurrent, meaning that the result container can support the accumulator function being called concurrently with the same result container from multiple threads. Concurrent collectors must always be stable.
        Returns:
        True if this collector supports concurrent accumulation
      • isStable

        default boolean isStable()
        Indicates that this collector is stable, meaning that the accumulator function always returns the result container passed in as its first argument.
        Returns:
        True if this collector is stable
Java™ Platform
Standard Ed. 8

DRAFT ea-b00

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2013, Oracle and/or its affiliates. All rights reserved.

DRAFT ea-b00