On Tue, 24 Mar 2026 19:41:59 GMT, Philemon Hilscher <[email protected]> wrote:

>> modules/javafx.controls/src/test/java/test/javafx/scene/control/ChoiceBoxTest.java
>>  line 620:
>> 
>>> 618:         AtomicInteger changeCount = new AtomicInteger();
>>> 619:         choiceBoxPopup.getItems()
>>> 620:                 .addListener((ListChangeListener.Change<? extends 
>>> MenuItem> _) -> changeCount.incrementAndGet());
>> 
>> this is very minor, but I'd recommend this format - it's clearer and one can 
>> actually set a breakpoint inside the listener:
>> 
>> choiceBoxPopup.getItems().addListener((ListChangeListener.Change<? extends 
>> MenuItem> _) -> {
>>   changeCount.incrementAndGet();
>> });
>
> I actually used the Intellij debug option during test development to set the 
> breakpoint just there, so it should be no problem to debug it.
> <img width="1078" height="112" alt="Image" 
> src="https://github.com/user-attachments/assets/9ea89e18-f9a1-45b8-b38c-64758bb1af40";
>  />

can't do it in Eclipse, it seems.

>> modules/javafx.controls/src/test/java/test/javafx/scene/control/ChoiceBoxTest.java
>>  line 646:
>> 
>>> 644:                 .addListener((ListChangeListener.Change<? extends 
>>> MenuItem> _) -> changeCount.incrementAndGet());
>>> 645: 
>>> 646:         box.getItems().addAll(IntStream.range(0, 
>>> 15).boxed().map(integer -> "Item " + integer).toList());
>> 
>> minor observation: maybe create a utility function for the code which is 
>> replicated more than three times?
>> 
>> 
>> box.getItems().addAll(createItemList(0, 15));
>
> For any fluent apis I think this is unnecessary, because removing code 
> duplications at all costs reduces readability.

`createItemList(0, 15)`

is less readable than

`IntStream.range(0, 15).boxed().map(integer -> "Item " + integer).toList()`

?

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2118#discussion_r2983956178
PR Review Comment: https://git.openjdk.org/jfx/pull/2118#discussion_r2983964774

Reply via email to