On Sat, 5 Feb 2022 05:08:54 GMT, yosbits <[email protected]> wrote:
>> This PR adds a predicate to TableView and TreeTableView selection models
>> order to remove rows from the selection only when there are no selected
>> cells in that given row, when cell selection is enabled.
>>
>> Two tests have been added as well, that fail without this PR and pass with
>> it.
>
> Why not use IntPredicate?
>
> before
>
> ``` java
> public static <S> void updateSelectedIndices(MultipleSelectionModelBase<S> sm,
> ListChangeListener.Change<? extends TablePositionBase<?>> c,
> Predicate<Integer> removeRowFilter) {
>
>
> after
>
> ``` java
> public static <S> void updateSelectedIndices(MultipleSelectionModelBase<S>
> sm,
> ListChangeListener.Change<? extends TablePositionBase<?>> c,
> IntPredicate removeRowFilter) {
>
>
> before
> ``` java
> .map(TablePositionBase::getRow)
>
>
> after
> ``` java
> .mapToInt(TablePositionBase::getRow)
@yososs Do you see any possible gain by using `IntPredicate` vs
`Predicate<Integer>?
It changes the `Stream<Integer>` to `IntStream`, and that needs an extra
`.boxed()` operation (or alternatively an extra operation to transform the int
array with `.collect(ArrayList::new, ArrayList::add, ArrayList::addAll)`).
So I'm wondering if this is worthy?
-------------
PR: https://git.openjdk.java.net/jfx/pull/709