today i encountered another thing i don't really understand while trying to learn more about JavaFX and Java in general.
Reference is the following tutorial (im trying to apply the principle to an organizer):
I will give a short outline of the particular part on which i've got a question:
My main window contains a tableview which shows some appointment-data. So i got some lines of this style(same as in the tutorial):
aColumn.setCellValueFactory(cellData ->cellData.getValue().getAColumnsProperty());
The data can be manipulated via an additional EditDialog. That works just fine. If i edit things the changes are displayed immediately but i did some additional research to better understand the Lambda (not too successful). Now...in the online java documentation Java Doc PropertyValueFactory it says: "A convenience implementation of the Callback-Interface,[...]"
So i refactored my code into this style:
aColumn.setCellValueFactory(new PropertyValueFactory<Appointment,LocalDate>("date"));
Which i find much more readable than the Lambda. But i noticed that when i make changes i need to do some sorting on the TableView before the changes are displayed.
Is it possible to achieve an immediate display of change in the second approach?
If yes: are there major disavantages which would discourage such a modification? I.e. would the Lambda be the best practice in this situation?
I appreciate any help.