Add getAndSet to MutableBoolean
@@ -22,6 +22,12 @@ public class MutableBoolean {
public void orSet(boolean value) { this.value |= value; }
+ public boolean getAndSet(boolean newValue) {
+ boolean prev = value;
+ value = newValue;
+ return prev;
+ }
+
@Override
public String toString() { return Boolean.toString(value); }
