📜  空地图入口java代码示例

📅  最后修改于: 2022-03-11 14:52:12.156000             🧑  作者: Mango

代码示例1
import java.util.Map;

final class MyEntry implements Map.Entry {
    private final K key;
    private V value;

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

    @Override
    public K getKey() {
        return key;
    }

    @Override
    public V getValue() {
        return value;
    }

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