I have an application on JavaFX. In this application, I need to implement, the editor of the column. In the old version of the code worked perfectly:
myColumn.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<MyRowDataObject, String>>() {
@Override
public void handle(TableColumn.CellEditEvent<MyRowDataObject, String> t) {
((MyRowDataObject) t.getTableView().getItems().get(
t.getTablePosition().getRow())
).setFirstName(t.getNewValue());
}
}
);
but when I tried to rewrite the code using the lambda
myColumn.setOnEditCommit((TableColumn.CellEditEvent event) ->
((MyRowDataObject) event.getTableView().getItems().get(event.getTablePosition().getRow())).setEmail(event.getNewValue().toString())
);
I get an error :Error: java: incompatible types: incompatible parameter types in lambda expression Tell me how to specify the type of a lambda expression?
Maybe someone will be interested, turned to compile the code as follows.