Re: RFR: 8277535: Remove redundant Stream.distinct()/sorted() steps [v2]

2021-11-22 Thread Andrey Turbanov
> 1. Stream.distinct() is redundant before toSet() collector. Duplicates will 
> be collapsed by Collector.
> 2. Stream.sorted() is redundant before toMap() collector. Keys will be 
> shuffled by Collector (it's a HashMap in current implementation)

Andrey Turbanov has updated the pull request incrementally with one additional 
commit since the last revision:

  8277535: Remove redundant Stream.distinct()/sorted() steps
  update copyright year

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/5714/files
  - new: https://git.openjdk.java.net/jdk/pull/5714/files/b326898d..e0312d2d

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=5714=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=5714=00-01

  Stats: 3 lines in 3 files changed: 0 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5714.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5714/head:pull/5714

PR: https://git.openjdk.java.net/jdk/pull/5714


Re: RFR: 8277535: Remove redundant Stream.distinct()/sorted() steps

2021-11-22 Thread Pavel Rappo
On Mon, 27 Sep 2021 11:20:53 GMT, Andrey Turbanov  wrote:

> 1. Stream.distinct() is redundant before toSet() collector. Duplicates will 
> be collapsed by Collector.
> 2. Stream.sorted() is redundant before toMap() collector. Keys will be 
> shuffled by Collector (it's a HashMap in current implementation)

Looks good. Please update the copyright years before integrating.

Note that in general, removing distinct() immediately before Collectors.toSet() 
might change the behavior. If operated on an ordered stream, distinct() is 
guaranteed to yield a stable order.

-

Marked as reviewed by prappo (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/5714


RFR: 8277535: Remove redundant Stream.distinct()/sorted() steps

2021-11-22 Thread Andrey Turbanov
1. Stream.distinct() is redundant before toSet() collector. Duplicates will be 
collapsed by Collector.
2. Stream.sorted() is redundant before toMap() collector. Keys will be shuffled 
by Collector (it's a HashMap in current implementation)

-

Commit messages:
 - [PATCH] Remove redundant Stream.distinct()/sorted() steps

Changes: https://git.openjdk.java.net/jdk/pull/5714/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk=5714=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8277535
  Stats: 4 lines in 3 files changed: 0 ins; 4 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5714.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5714/head:pull/5714

PR: https://git.openjdk.java.net/jdk/pull/5714