public static < T > CompletionStage < T > doOnFxThread ( final T element , final Consumer < T > action ) { return CompletableFuture . supplyAsync ( ( ) -> { action . accept ( element ) ; return element ; } , Platform :: runLater ) ; }
Asynchronously executes a consuming operation on the JavaFX thread .