/**
* @author zakza
* @Description
* @create 2021-10-15 11:32
*/
@FunctionalInterface
public interface Procedure {
void run();
default Procedure andThen(Procedure after){
return () -> {
this.run();
after.run();
};
}
default Procedure compose(Procedure before){
return () -> {
before.run();
this.run();
};
}
}
使用方法,JavaFx 异步处理UI,Procedure用lamda表达式
public static void newPlatformRun(Procedure procedure) {
new Thread(() -> {
Platform.runLater(() -> {
procedure.run();
});
}).start();
}