Example usage for com.google.common.collect Multimap putAll

List of usage examples for com.google.common.collect Multimap putAll

Introduction

In this page you can find the example usage for com.google.common.collect Multimap putAll.

Prototype

boolean putAll(Multimap<? extends K, ? extends V> multimap);

Source Link

Document

Stores all key-value pairs of multimap in this multimap, in the order returned by multimap.entries() .

Usage

From source file:com.isotrol.impe3.freemarker.wrap.URIBuilderModel.java

private Multimap<String, String> merge(List<String> args) {
    Multimap<String, String> extra = buildURIQueryParameters(args, 0);
    if (extra.isEmpty()) {
        return parameters;
    }//from   ww  w  .j ava  2 s . co  m
    Multimap<String, String> total = LinkedListMultimap.create(parameters);
    total.putAll(extra);
    return total;
}

From source file:edu.sdsc.solr.lemmatization.LemmatizationWriter.java

Multimap<String, String> buildSynonymMap() throws IOException {
    final Multimap<String, String> synonyms = HashMultimap.create();
    synonyms.putAll(spec.getExtraSynonyms());

    Files.readLines(uncompressedDictionary, Charsets.UTF_8, new LineProcessor<Void>() {

        @Override/*  ww  w .j  av  a2 s. c o m*/
        public boolean processLine(String line) throws IOException {
            List<String> cols = newArrayList(Splitter.on('\t').split(line));
            String language = cols.get(0);
            if (!spec.getLanguages().contains(language)) {
                return true;
            }
            Optional<String> synonym = DefinitionParser.getSynonym(cols.get(3), spec);
            if (synonym.isPresent()) {
                synonyms.put(synonym.get(), cols.get(1).trim());
            }
            return true;
        }

        @Override
        public Void getResult() {
            return null;
        }
    });
    return synonyms;
}

From source file:org.sosy_lab.cpachecker.pcc.strategy.partitioning.PartitionChecker.java

public void addPartitionElements(final Multimap<CFANode, AbstractState> pPartitionElements) {
    pPartitionElements.putAll(partitionParts);
}

From source file:jflowmap.FlowMapGraphSet.java

/**
 * Builds a multimap between the values of the given {@nodeAttr} and the
 * node ids having these values. The multimap is built over the whole set
 * of flow map graphs.//  ww  w .j a v  a 2  s  .  c o m
 */
public Multimap<Object, String> multimapOfNodeAttrValuesToNodeIds(String nodeAttr) {
    Multimap<Object, String> nodeAttrValuesToNodeIds = LinkedHashMultimap.create();
    for (FlowMapGraph fmg : asList()) {
        nodeAttrValuesToNodeIds.putAll(fmg.multimapOfNodeAttrValuesToNodeIds(nodeAttr));
    }
    return nodeAttrValuesToNodeIds;
}

From source file:org.terasology.config.InputConfig.java

/**
 * Sets this InputConfig to be identical to other
 * @param other The InputConfig to copy// w w w .  jav a 2  s.  co  m
 */
public void setInputs(InputConfig other) {
    data.clear();
    for (String key : other.data.keySet()) {
        Multimap<String, Input> map = getPackageMap(key);
        map.putAll(other.data.get(key));
    }
}

From source file:org.terasology.config.BindsConfig.java

/**
 * Sets this BindsConfig to be identical to other
 *
 * @param other The BindsConfig to copy// w  ww  . jav a  2  s. c  o  m
 */
public void setInputs(BindsConfig other) {
    data.clear();
    for (String key : other.data.keySet()) {
        Multimap<String, Input> map = getPackageMap(key);
        map.putAll(other.data.get(key));
    }
}

From source file:eu.esdihumboldt.hale.common.core.report.ReportSession.java

/**
 * Get all reports./*from w  w  w .j  a  v a2  s .  c om*/
 * 
 * @return reports
 */
public Multimap<Class<? extends Report<?>>, Report<?>> getAllReports() {
    // create a map
    Multimap<Class<? extends Report<?>>, Report<?>> reportMap = HashMultimap.create();

    // iterate through all reports
    for (Multimap<Class<? extends Report<?>>, Report<?>> map : this.reports.values()) {
        reportMap.putAll(map);
    }

    return reportMap;
}

From source file:org.jclouds.joyent.sdc.v6_5.options.CreateMachineOptions.java

@Override
public Multimap<String, String> buildQueryParameters() {
    Multimap<String, String> params = super.buildQueryParameters();
    if (name != null)
        params.put("name", name);
    if (pkg != null)
        params.put("package", pkg);
    params.putAll(Multimaps.forMap(Maps2.transformKeys(metadata, new Function<String, String>() {

        @Override// ww w.jav a  2  s.  c  o m
        public String apply(String input) {
            return "metadata." + input;
        }

    })));
    return params;
}

From source file:uk.ac.ebi.intact.dataexchange.psimi.solr.ontology.LazyLoadedOntologyTerm.java

protected Multimap<Integer, OntologyTerm> getChildren(OntologyTerm term, int currentDepth, int maxDepth) {
    if (currentDepth > maxDepth) {
        return HashMultimap.create();
    }/*from ww  w  . ja  v a  2 s . c o  m*/

    Multimap<Integer, OntologyTerm> terms = HashMultimap.create();
    terms.put(currentDepth, term);

    for (OntologyTerm child : term.getChildren()) {
        terms.putAll(getChildren(child, currentDepth + 1, maxDepth));
    }

    return terms;
}

From source file:com.github.haixing_hu.lang.Assignment.java

/**
 * Shallowly clones a multi-map.//from  w ww  .j  a v a 2  s  .  c  o m
 *
 * @param <K>
 *          The type of the key of the multi-map to be cloned.
 * @param <V>
 *          The type of the value of the multi-map to be cloned.
 * @param map
 *          The source multi-map to be cloned, which could be null.
 * @return The cloned copy of the source multi-map; or null if the source map is
 *         null. Note that the objects in the source multi-map is simply copied
 *         into the returned multi-map, thus this is a shallow clone.
 */
public static <K, V> Multimap<K, V> clone(@Nullable final Multimap<K, V> map) {
    if (map == null) {
        return null;
    } else {
        final Multimap<K, V> result = LinkedHashMultimap.create();
        result.putAll(map);
        return result;
    }
}