io.sphere.sdk.categories.Multimap Maven / Gradle / Ivy
package io.sphere.sdk.categories;
import java.util.*;
final class Multimap {
private final Map> underlyingMap = new HashMap<>();
public void put(final K key, final V value) {
final List entriesForKey = underlyingMap.getOrDefault(key, new LinkedList<>());
entriesForKey.add(value);
underlyingMap.put(key, entriesForKey);
}
public Collection get(final K key) {
return underlyingMap.getOrDefault(key, new LinkedList<>());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy