A DESCRIPTION OF THE PROBLEM :
When having a lot of data and playing with multiple selection there are situations where it could get very very slow, even though in Java8 it was not. In my case I need to have a lot of data in a ListView (~50k), and when I do stuff like first selecting all items, and then shift+clicking to have only a subset selected, it can take a good couple of minutes before finishing, making the program unusable during that time.
It happens with Java9 as well.
REGRESSION : Last worked in version 8u161
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Prepare a list view with a lot of items (the bigger the list, the easier to notice the issue) for example 50_000
2) perfrom ctrl+a on a list to select all it's items
3) while having all items selected, do shift+click on one of the items to reduce the selection (for example click on the 3rd item on the list)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
selection should change to first 3 items only almost instantly
ACTUAL -
selection takes a couple of minutes, making the whole program unreponsive during that time
---------- BEGIN SOURCE ----------
public class StringPlayground2 extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
int ELEMENTS = 55_000;
List<String> stringList = new ArrayList<>(ELEMENTS);
for (int i = 0; i < ELEMENTS; i++) {
stringList.add("" + i);
}
ListView<String> listView = new ListView<>(FXCollections.observableArrayList(stringList));
listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
// listView.getSelectionModel().getSelectedItems()
// .addListener((ListChangeListener) c -> System.out.println(c.getList().size()));
primaryStage.setScene(new Scene(listView, 640, 480));
primaryStage.show();
}
}
---------- END SOURCE ----------
FREQUENCY : always