groostav
01/19/2017, 11:59 PMsuper.updateItem(item, empty)
this.setText(isEmpty ? null : item.toString())
the next thing, if you really dont want to use javafx's built in StringConverter system designed for exactly this purpose, would then be to extract a generic type and a delegate:
//kotlin
class MyListCell<T>(val toStringDelegate: (T) -> String){
override fun updateItem(item: T?, empty: Boolean){
super.updateItem(item, empty)
this.text = if(item == null) null else toStringDelegate.invoke(item)
}
}
then you can probably inline your four methods to their callsite
createEvaluableCell()
//becomes simpl
new MyListCell(evaluable -> evaluable.getResultSymbol().getCanonicalName())