In general, this is not entirely possible, since lists and sets have different functionality (sets are unordered and lists are ordered, lists can contain duplicates, but sets cannot).
You can make sure that it ListViewdisplays items from ObservableSetwith code similar to the following:
ObservableSet<String> set = FXCollections.observableSet();
ListView<String> listView = new ListView<>();
set.addListener((Change<? extends String> c) -> {
if (c.wasAdded()) {
listView.getItems().add(c.getElementAdded());
}
if (c.wasRemoved()) {
listView.getItems().remove(c.getElementRemoved());
}
});
ListView , () listView.getItems() .