/**
 * Copyright 2015 Palantir Technologies
 *
 * Licensed under the BSD-3 License (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://opensource.org/licenses/BSD-3-Clause
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.palantir.util;

import java.io.Serializable;

/**
 * Simple generic class to use in situations where something needs to be final to be passed into a closure.
 * This should be preferred over using an array of size 1 to pass an object around.  The reference
 * is also volatile so it can be used for cross-thread purposes.
 *
 * @author carrino
 * @serial exclude
 *
 * @param <T> the type of the value being enclosed
 */
public class Mutable<T> implements Serializable {
    private static final long serialVersionUID = 1L;

    private volatile T value;

    Mutable(T val) {
        value = val;
    }

    /**
     * Sets the enclosed object for an empty
     * <code>Mutable</code>.
     */
    public void set(T val) {
        value = val;
    }

    /**
     * Returns the value enclosed by this <code>Mutable</code>.
     */
    public T get() {
        return value;
    }

    /**
     * Returns a hash code of the <code>Mutable</code>'s value.
     */
    @Override
    public int hashCode() {
        T v = get();
        if(v == null)
            return 0;
        return v.hashCode();
    }

    /**
     * Returns <code>true</code> if this <code>Mutable</code>
     * is equal to the given object.
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (!(obj instanceof Mutable<?>))
            return false;
        final Mutable<?> other = (Mutable<?>) obj;
        T v = get();
        Object otherV = other.get();

        if (v == null) {
            if (otherV != null)
                return false;
        } else if (!v.equals(otherV))
            return false;
        return true;
    }

    @Override
    public String toString() {
        return String.valueOf(value);
    }
}

@@ -1154,16 +1154,419 @@
 e;%0A%0A    
+public static%3CT%3E Mutable%3CT%3E create() %7B%0A        return new Mutable%3CT%3E();%0A    %7D%0A%0A    /**%0A     * Constructs and returns an empty%0A     * %3Ccode%3EMutable%3C/code%3E. Use %7B@link #set(Object)%7D%0A     * to add the enclosed object.%0A     */%0A    public Mutable() %7B%0A        this(null);%0A    %7D%0A%0A    /**%0A     * Constructs and returns a new %3Ccode%3EMutable%3C/code%3E%0A     * containing the given %3Ccode%3Eval%3C/code%3E.%0A     */%0A    public 
 Mutable(

revert changes to mutable (for backwards compatability)