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

org.jfrog.build.api.multiMap.SetMultimap Maven / Gradle / Ivy

There is a newer version: 2.41.23
Show newest version
package org.jfrog.build.api.multiMap;

import java.util.Collection;
import java.util.HashSet;
import java.util.Map;

/**
 * A multimap that uses a {@link HashSet} to store the values.
 */
public class SetMultimap extends Multimap {
    public SetMultimap() {
        super();
    }

    /**
     * Constructor that accepts a map.
     *
     * @param map the map
     */
    public SetMultimap(Map map) {
        super(map);
    }

    /**
     * Put a key-value pair into the multimap.
     *
     * @param key   the key
     * @param value the value
     */
    public void put(Key key, Value value) {
        Collection currentValue = multiMap.getOrDefault(key, new HashSet<>());
        currentValue.add(value);
        multiMap.put(key, currentValue);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy