src/main/java/com/github/fge/grappa/misc/Reference.java
public final T getAndSet(final T value)
    {
        final T ret = this.value;
        this.value = value;
        return ret;
    }
public final T getAndSet(final T value)
    {
        final T ret = this.value;
        this.value = value;
        return ret;
    }
Replaces this references value with the given one.

@param value the new value
@return the previous value