Created
April 13, 2011 03:56
-
-
Save berlinbrown/916940 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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