On Mon, 7 Feb 2022 10:24:01 GMT, Jose Pereda <jper...@openjdk.org> 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.
>
> Jose Pereda has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Address feedback from reviewer

getRow () returns an int.
It is more efficient to process the primitive as it is.
The code below will be less boxing.
Because filter and distinct are processes for primitives
It can be done at high speed.

``` java
            final List<Integer> removed = c.getRemoved().stream()
                    .mapToInt(TablePositionBase::getRow)
                    .distinct()
                    .filter(removeRowFilter)
                    .boxed()
                    .peek(sm.selectedIndices::clear)
                    .collect(Collectors.toList());

            final int addedSize = (int)c.getAddedSubList().stream()
                    .mapToInt(TablePositionBase::getRow)
                    .distinct()
                    .boxed()
                    .peek(sm.selectedIndices::set)
                    .count();

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

PR: https://git.openjdk.java.net/jfx/pull/709

Reply via email to