As written in the documentation :
Wraps around the ObservableList and filters its contents using the provided Predicate. All changes to the ObservableList are propagated immediately to the FilteredList.
Therefore, you can shuffle the source code ObservableList:
FXCollections.shuffle(ob);
Example:
ObservableList<String> obsList =
FXCollections.observableArrayList("Amanda", "Bill", "Adam", "Albus", "Cicero");
FilteredList<String> fList = new FilteredList<>(obsList, s -> s.startsWith("A"));
System.out.println(fList);
FXCollections.shuffle(obsList);
System.out.println(fList);
Conclusion:
[Amanda, Adam, Albus]
[Adam, Albus, Amanda]
source
share