personthecat.catlib.data.collections.MultiValueHashMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of catlib-quilt Show documentation
Show all versions of catlib-quilt Show documentation
Utilities for serialization, commands, noise generation, IO, and some new data types.
The newest version!
package personthecat.catlib.data.collections;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@SuppressWarnings("unused")
public class MultiValueHashMap extends HashMap> implements MultiValueMap {
@Override
public void add(final K k, final V v) {
if (!containsKey(k)) {
put(k, new ArrayList<>());
}
get(k).add(v);
}
}