Skip to content

Instantly share code, notes, and snippets.

@Audhil
Created August 20, 2025 12:51
Show Gist options
  • Save Audhil/62c2bb845402b72d6e0cb8bdf94b3cd7 to your computer and use it in GitHub Desktop.
Save Audhil/62c2bb845402b72d6e0cb8bdf94b3cd7 to your computer and use it in GitHub Desktop.
All about Executors!
import java.util.concurrent.Executor;
public class ExecutorsSample {
public static void main(String[] args) {
// Executor executor = new Executor() {
// @Override
// public void execute(Runnable command) {
// command.run();
// }
// };
// we can simply write as follows
Executor executor = Runnable::run;
// placing runnable in executor
executor.execute(new Runnable() {
@Override
public void run() {
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment