Example usage for com.google.common.collect HashMultimap create

List of usage examples for com.google.common.collect HashMultimap create

Introduction

In this page you can find the example usage for com.google.common.collect HashMultimap create.

Prototype

public static <K, V> HashMultimap<K, V> create() 

Source Link

Document

Creates a new, empty HashMultimap with the default initial capacities.

Usage

From source file:co.cask.cdap.etl.common.SetMultimapCodec.java

@Override
public SetMultimap<K, V> deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
        throws JsonParseException {
    JsonObject obj = json.getAsJsonObject();
    Map<K, Collection<V>> map = context.deserialize(obj.get("map"), mapType);
    SetMultimap<K, V> multimap = HashMultimap.create();
    for (Map.Entry<K, Collection<V>> entry : map.entrySet()) {
        multimap.putAll(entry.getKey(), entry.getValue());
    }// w  w w  .  j  a  v  a  2  s  .c o m
    return multimap;
}

From source file:org.sosy_lab.cpachecker.cpa.wp.segkro.rules.EquivalenceRule.java

@Override
public Set<BooleanFormula> apply(List<BooleanFormula> pConjunctiveInputPredicates) {

    Set<BooleanFormula> result = Sets.newHashSet();
    HashMultimap<NumeralFormula, NumeralFormula> isLessEqualThan = HashMultimap.create();

    // Create an index
    for (BooleanFormula conjunctive : pConjunctiveInputPredicates) {
        isLessEqualThan.putAll(extractIsLessEqualThans(conjunctive));
    }//from  w  w  w .j  av a 2  s. com

    // Infer the equalities (SAT check could be used)
    for (NumeralFormula lessOrEqual : isLessEqualThan.keySet()) {
        Set<NumeralFormula> greaterOrEqual = isLessEqualThan.get(lessOrEqual);
        if (greaterOrEqual.size() > 1) {

        }
    }

    return result;
}

From source file:games.stendhal.server.core.engine.db.StendhalBuddyDAO.java

/**
 * loads the relationship lists for the specified charname
 *
 * @param transaction DBTransaction/* w  ww  . j av a 2  s .  c  o m*/
 * @param charname name of char
 * @return buddy list
 * @throws SQLException in case of an database error
 */
public Multimap<String, String> loadRelations(DBTransaction transaction, String charname) throws SQLException {
    HashMultimap<String, String> map = HashMultimap.create();
    String query = "SELECT relationtype, buddy FROM buddy WHERE charname='[charname]'";
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("charname", charname);
    ResultSet resultSet = transaction.query(query, params);
    while (resultSet.next()) {
        map.put(resultSet.getString(1), resultSet.getString(2));
    }
    return map;
}

From source file:io.github.proxyprint.kitchen.utils.NotificationManager.java

public NotificationManager() {
    this.subscriptions = HashMultimap.create();
}

From source file:org.geogig.osm.internal.FeatureMapFlusher.java

public FeatureMapFlusher(Repository repository) {
    this.repository = repository;
    map = HashMultimap.create();
    count = 0;
}

From source file:com.qcadoo.mes.workPlans.pdf.document.operation.grouping.container.util.OrderIdOperationNumberOperationComponentIdMap.java

public void put(Long orderId, String operationNumber, Long operationComponentId) {
    Multimap<String, Long> innerMap = map.get(orderId);
    if (innerMap == null) {
        innerMap = HashMultimap.create();
        map.put(orderId, innerMap);//w  w w  .jav a  2 s .co m
    }
    innerMap.put(operationNumber, operationComponentId);
}

From source file:org.eclipse.xtext.graphview.style.StyleProvider.java

protected Multimap<AbstractMapping, Style> loadStyles(
        IDiagramConfigurationProvider graphViewDefinitionProvider) {
    Multimap<AbstractMapping, Style> mapping2style = HashMultimap.create();
    if (graphViewDefinitionProvider.getStyleSheet() != null) {
        for (Style style : graphViewDefinitionProvider.getStyleSheet().getStyles()) {
            for (AbstractMapping mapping : style.getMappings())
                mapping2style.put(mapping, style);
        }/*w ww  .jav  a 2  s .  c om*/
    }
    return mapping2style;
}

From source file:edu.uci.ics.sourcerer.tools.java.extractor.missing.MissingPackage.java

void addPotentialName(MissingName name) {
    if (potentialNames == null) {
        potentialNames = HashMultimap.create();
    }//from   w w w. j  a v  a  2  s. c o  m
    potentialNames.put(name.getName(), name);
    name.addPotentialOwner(this);
}

From source file:com.exentes.maven.versions.VersionMojoUtils.java

public static SetMultimap<Artifact, MavenProject> allSnapshotProjectArtifacts(MavenSession session) {
    SetMultimap<Artifact, MavenProject> allSnapshotProjectArtifacts = HashMultimap.create();

    for (MavenProject project : session.getProjects()) {
        for (Artifact artifact : difference(newHashSet(filterSnapshots(project.getDependencyArtifacts())),
                newHashSet(transform(session.getProjects(), toProjectArtifactFunction)))) {
            allSnapshotProjectArtifacts.put(artifact, project);
        }//  w w  w .  j  av  a 2s . co m
    }
    return allSnapshotProjectArtifacts;
}

From source file:org.carrot2.output.metrics.IdealPartitioningBasedMetric.java

/**
 * Returns documents grouped by partitions.
 *//*w  ww  .  j av a 2  s . com*/
SetMultimap<Object, Document> getDocumentsByPartition(List<Document> documents) {
    final SetMultimap<Object, Document> index = HashMultimap.create();
    for (Document document : documents) {
        final Collection<Object> partitions = document.getField(partitionIdFieldName);
        for (Object partition : partitions) {
            index.put(partition, document);
        }
    }

    return ImmutableSetMultimap.copyOf(index);
}