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

commons.box.app.DataEntry Maven / Gradle / Ivy

The newest version!
package commons.box.app;

import java.util.Map;
import java.util.Objects;

/**
 * 元素节点
 *
 * @param 
 */
public final class DataEntry implements Map.Entry, DataObject {
    private static final long serialVersionUID = 9069687761676127614L;

    private final K key;
    private V value;

    public DataEntry(K key) {
        this.key = key;
    }

    public DataEntry(K key, V value) {
        this.key = key;
        this.value = value;
    }

    public K getKey() {
        return key;
    }

    public V getValue() {
        return value;
    }

    @Override
    public V setValue(V value) {
        V old = this.value;
        this.value = value;
        return old;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DataEntry dataEntry = (DataEntry) o;
        return Objects.equals(key, dataEntry.key) &&
                Objects.equals(value, dataEntry.value);
    }

    @Override
    public int hashCode() {
        return Objects.hash(key, value);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy