Skip to content

Instantly share code, notes, and snippets.

@berlinbrown
Created April 13, 2011 03:56
Show Gist options
  • Save berlinbrown/916940 to your computer and use it in GitHub Desktop.
Save berlinbrown/916940 to your computer and use it in GitHub Desktop.
public static final class Mutable<T> {
private T mutable;
/**
* Constructor.
* @param m
*/
public Mutable(final T m) {
this.mutable = m;
}
/**
* Set the mutable.
* @param val
* @return
*/
public synchronized T set(final T val) {
this.mutable = val;
return mutable;
}
public synchronized T get() {
return mutable;
}
@Override
public String toString() {
return String.valueOf(mutable);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment