// Copyright (c) 2020 UWB & LESP.
// The UWB & LESP license this file to you under the MIT license.

package cz.senslog.connector.model.converter;

import java.util.HashMap;
import java.util.Map;

public class ReverseMap<K, V> extends HashMap<K, V> {
    private final Map<V, K> reverseMap = new HashMap<>();

    @Override
    public V put(K key, V value) {
        reverseMap.put(value, key);
        return super.put(key, value);
    }

    public V getValue(K key) {
        return super.get(key);
    }

    public K getKey(V value) {
        return reverseMap.get(value);
    }
}
