RFR: JDK-8263411: Convert jshell tool to use Stream.toList() [v2]

Jan Lahoda jlahoda at openjdk.java.net
Tue Mar 23 16:43:43 UTC 2021


On Thu, 18 Mar 2021 22:25:51 GMT, Ian Graves <igraves at openjdk.org> wrote:

>> This converts jshell from using `Stream.collect(Collectiors.toList())` to `Stream.toList()` - an immutable list with better performance characteristics. Local inspection only turned up one place that was mutating a resulting list and that has been refactored. 
>> 
>> This work is a subtask to: https://bugs.openjdk.java.net/browse/JDK-8260559
>
> Ian Graves has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Removing most explicit casts and refactoring a Stream use

src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java line 1689:

> 1687:                                 }
> 1688:                             })
> 1689:                             .map(e -> (Suggestion) e)

I guess I'd get rid of the cast here as well. Otherwise looks good!

-------------

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


More information about the kulla-dev mailing list