On Wed, 23 Apr 2025 16:06:54 GMT, Johannes Döbler <d...@openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   8354724: Add missing toList(), tweak verbiage; update test
>
> test/jdk/java/io/BufferedReader/ReadAll.java line 72:
> 
>> 70:         int size = rnd.nextInt(2, 16386);
>> 71: 
>> 72:         try (FileChannel fc = FileChannel.open(path, CREATE, WRITE)) {
> 
> Why not just create a `List<String>` of lines and then write it to the file 
> using `Files.write(Path, Iterable<? extends CharSequence>, Charset, 
> OpenOption...)`

Good idea: much more compact. So changed in 
[edb813d](https://github.com/openjdk/jdk/pull/24728/commits/edb813da0057e78e44543c55000e174456cbe965).
 Thanks.

> test/jdk/java/io/BufferedReader/ReadAll.java line 107:
> 
>> 105:         List<String> lines;
>> 106:         try (FileReader fr = new FileReader(file);
>> 107:              BufferedReader br = new BufferedReader(fr)) {
> 
> could be simplified to
> try (BufferedReader br = new BufferedReader(new FileReader(file))) {

Indeed that is better. So changed in 
[edb813d](https://github.com/openjdk/jdk/pull/24728/commits/edb813da0057e78e44543c55000e174456cbe965).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2056497453
PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2056497701

Reply via email to