RFR: JDK-8205461 Create Collector which merges results of two other collectors

Stuart Marks stuart.marks at oracle.com
Tue Aug 21 17:43:34 UTC 2018


On 8/21/18 12:04 AM, Peter Levart wrote:
>>  - UNORDERED: should the returned collector be UNORDERED if *either* of the 
>> provided collectors is UNORDERED? (Current draft says *both*.)
>
> I think *both* is the right behavior. If you are collecting:
>
>     teeingAndThen(
>         Collectors.toList(),
>         Collectors.toSet(),
>         Map::entry
>     )
>
> ...then you might want the returned List part of result to respect encounter 
> order regardless of the returned Set part which doesn't.
OK, this makes sense. Seems like it should be "both" then.

s'marks



More information about the core-libs-dev mailing list