All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kaka.util.mutable.Mutable Maven / Gradle / Ivy

package com.kaka.util.mutable;

import java.io.Serializable;

/**
 * @author zkpursuit
 */
public class Mutable implements Serializable {
    private T value;

    public Mutable() {
    }

    public Mutable(T value) {
        this.value = value;
    }

    public T get() {
        return value;
    }

    public void set(T value) {
        this.value = value;
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (this == obj) {
            return true;
        }
        if (this.getClass() == obj.getClass()) {
            Mutable that = (Mutable) obj;
            return this.value.equals(that.value);
        }
        return false;
    }

    public int hashCode() {
        return this.value == null ? 0 : this.value.hashCode();
    }

    public String toString() {
        return this.value == null ? "null" : this.value.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy