Skip to content

Instantly share code, notes, and snippets.

@ldematte
Created September 6, 2016 13:07
Show Gist options
  • Save ldematte/85529316fc22beda7e8f18fefa65200c to your computer and use it in GitHub Desktop.
Save ldematte/85529316fc22beda7e8f18fefa65200c to your computer and use it in GitHub Desktop.
"Reference" class for manual closures in Java (useful in lamdbas)
private static class Ref<T> {
private T value;
public Ref(T value) {this.value = value;}
public static<U> Ref<U> of(U t) { return new Ref<U>(t); }
public T getValue() { return value; }
public void setValue(T value) { this.value = value; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment