package net.ranides.assira.collection.maps;

import java.util.Collection;
import java.util.Set;

import net.ranides.assira.collection.sets.SetUtils;

/**
 * @author msieron
 */
public abstract class AGenericMap<K> implements GenericMap<K> {

    @Override
    public abstract int size();

    @Override
    public abstract boolean containsKey(GenericKey<K, ?> key);

    @Override
    public abstract <V> V get(GenericKey<K, V> key);

    @Override
    public abstract Set<GenericEntry<K>> entrySet();

    @Override
    public <V> V put(GenericKey<K, V> key, V value) {
        throw new UnsupportedOperationException();
    }

    @Override
    public <V> V remove(GenericKey<K, V> key) {
        throw new UnsupportedOperationException();
    }

    @Override
    public Set<GenericKey<K, ?>> keySet() {
        return SetUtils.map(entrySet(), e -> e.getKey());
    }

    @Override
    public Collection<?> values() {
        return SetUtils.map(entrySet(), e -> e.getValue());
    }


}
