Skip to content

Instantly share code, notes, and snippets.

@carchrae
Created October 2, 2013 14:19
Show Gist options
  • Select an option

  • Save carchrae/6794509 to your computer and use it in GitHub Desktop.

Select an option

Save carchrae/6794509 to your computer and use it in GitHub Desktop.
My take on a java promise interface
public interface Promise<T> {
Promise<T> resolve(T value);
Promise<T> resolve(Promise<T> promise);
Promise<Throwable> reject(Throwable e);
Promise<T> then(CallbackFunction onResolved);
Promise<T> then(CallbackFunction onResolved, CallbackFunction onError);
Promise<T> then(CallbackFunction onResolved, CallbackFunction onError,
CallbackFunction onNotify);
Promise<T> ensure(CallbackFunction handler);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment