I have some method for work with the TableView.
private void setClusterSelectionHelp() {
List<Cluster> clusters = tableCluster.getSelectionModel().getSelectedItems();
int clusterCount = clusters.size();
for (int i = 0; i < clusterCount; i++) {
System.out.println(clusters.get(i).toString());
System.out.println(clusters.get(i).toString());
}
}
This method is called from selection change listener.
tableCluster.getSelectionModel().selectedItemProperty().addListener((obs,
oldSelection, newSelection) -> {
setClusterSelectionHelp();
});
The code of method is replaced by some abstraction for better understanding.
In most cases, both "println" output the string of object. But sometimes the first line displays "null". This "sometimes" I can't describe, because it happens randomly.
Can someone explain what is this black magic ?