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

net.lenni0451.commons.collections.maps.DelegateMap Maven / Gradle / Ivy

The newest version!
package net.lenni0451.commons.collections.maps;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Map;
import java.util.Set;

/**
 * A map which delegates all calls to the given map.
 *
 * @param  The type of the keys in this map
 * @param  The type of the values in this map
 */
public class DelegateMap implements Map {

    private final Map delegate;

    public DelegateMap(final Map delegate) {
        this.delegate = delegate;
    }

    @Override
    public int size() {
        return this.delegate.size();
    }

    @Override
    public boolean isEmpty() {
        return this.delegate.isEmpty();
    }

    @Override
    public boolean containsKey(Object key) {
        return this.delegate.containsKey(key);
    }

    @Override
    public boolean containsValue(Object value) {
        return this.delegate.containsValue(value);
    }

    @Override
    public V get(Object key) {
        return this.delegate.get(key);
    }

    @Nullable
    @Override
    public V put(K key, V value) {
        return this.delegate.put(key, value);
    }

    @Override
    public V remove(Object key) {
        return this.delegate.remove(key);
    }

    @Override
    public void putAll(@Nonnull Map m) {
        this.delegate.putAll(m);
    }

    @Override
    public void clear() {
        this.delegate.clear();
    }

    @Nonnull
    @Override
    public Set keySet() {
        return this.delegate.keySet();
    }

    @Nonnull
    @Override
    public Collection values() {
        return this.delegate.values();
    }

    @Nonnull
    @Override
    public Set> entrySet() {
        return this.delegate.entrySet();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy