Java tutorial
public class Main { public static void main(String[] args) { Runnable runnable = andThen(() -> System.out.print("Hello "), () -> System.out.print("World!")); new Thread(runnable).start(); } static Runnable andThen(Runnable r1, Runnable r2) { return () -> { r1.run(); r2.run(); }; } }