Skip to content

Instantly share code, notes, and snippets.

View fortraan's full-sized avatar

fortraan

View GitHub Profile
@fortraan
fortraan / AsyncTask.java
Last active January 27, 2019 19:24
Lightweight asynchronous tasks for Java 1.9
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
/**
* Lightweight lambda-based async. Tasks can be chained together using
* {@link #andThen(AsyncTask, long)}, with a delay between them.
*
* If you don't want arguments, make T {@link Void}, then pass null to