Runnable action = () -> {
System.out.println("Hello! I'm in another thread!");
};
Multithreading.submit(action);
val action = Runnable {
println("Hello! I'm in another thread!")
}
Multithreading.submit(action)
Scheduling an action to run after some time
Runnable action = () -> {
System.out.println("Hello! I'm in another thread and was run after 5 seconds!");
};
Mulithreading.schedule(action, 5, TimeUnit.SECONDS);
val action = Runnable {
println("Hello! I'm in another thread and was run after 5 seconds!")
}
Mulithreading.schedule(action, 5, TimeUnit.SECONDS)