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

personthecat.catlib.data.collections.MultiValueHashMap Maven / Gradle / Ivy

Go to download

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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy