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:org.eclipse.xtext.ui.refactoring.impl.ReferenceDescriptionSorter.java

public Multimap<IProject, IReferenceDescription> sortByProject(
        Iterable<IReferenceDescription> referenceDescriptions) {
    Multimap<IProject, IReferenceDescription> referencesByProject = HashMultimap.create();
    for (IReferenceDescription referenceDescription : referenceDescriptions) {
        URI sourceResourceUri = referenceDescription.getSourceEObjectUri().trimFragment();
        IProject project = projectUtil.getProject(sourceResourceUri);
        if (project != null) {
            referencesByProject.put(project, referenceDescription);
        }/* w  w w .  j  ava2  s  .c  o m*/
    }
    return referencesByProject;
}

From source file:io.covert.dns.storage.accumulo.mutgen.EdgeMutationGeneratorFactory.java

@Override
public MutationGenerator create(Configuration conf) throws Exception {

    Multimap<String, String> edges = HashMultimap.create();
    for (String edge : conf.get("edge.mutation.generator.edges").split(",")) {
        String names[] = edge.split(":", 2);
        edges.put(names[0], names[1]);// w  w  w.j a va2 s  .c  o m
    }

    System.out.println(edges);

    return new EdgeMutationGenerator(conf.get("edge.mutation.generator.table"),
            conf.get("edge.mutation.generator.data.type"), edges,
            conf.getBoolean("edge.mutation.generator.bidirection", true),
            conf.getBoolean("edge.mutation.generator.univar.stats", true));
}

From source file:edu.cmu.lti.oaqa.baseqa.answer.CavUtil.java

public static SetMultimap<Token, Token> getHeadTokenMap(Collection<Token> tokens) {
    SetMultimap<Token, Token> head2children = HashMultimap.create();
    tokens.stream().filter(token -> token.getHead() != null)
            .forEach(token -> head2children.put(token.getHead(), token));
    return head2children;
}

From source file:com.google.gerrit.testutil.FakeAccountByEmailCache.java

public FakeAccountByEmailCache() {
    byEmail = HashMultimap.create();
    anyEmail = new HashSet<>();
}

From source file:org.eclipse.tracecompass.tmf.core.trace.TmfEventTypeCollectionHelper.java

/**
 * Gets a map from event name to a collection of field names from a
 * collection of event types/*from   w ww.ja  v  a  2s . c  o m*/
 *
 * @param eventTypes
 *            an iterable collection of ITmfEventTypes
 * @return a set of the names of these events, if some event names are
 *         clashing they will only appear once
 * @since 2.0
 */
public static Multimap<@NonNull String, @NonNull String> getEventFieldNames(
        Iterable<@NonNull ? extends ITmfEventType> eventTypes) {
    Multimap<@NonNull String, @NonNull String> retMap = HashMultimap.create();
    eventTypes.forEach(eventType -> {
        Collection<String> collection = eventType.getFieldNames();
        if (collection != null) {
            collection.forEach(field -> {
                if (field != null) {
                    retMap.put(eventType.getName(), field);
                }
            });
        }
    });
    return retMap;
}

From source file:io.datakernel.cube.AggregationKeyRelationships.java

public AggregationKeyRelationships(Map<String, String> childParentRelationships) {
    this.childParentRelationships = childParentRelationships;
    this.parentChildRelationships = HashMultimap.create();
    for (Map.Entry<String, String> parentChildEntry : childParentRelationships.entrySet()) {
        String parent = parentChildEntry.getKey();
        String child = parentChildEntry.getValue();
        parentChildRelationships.put(child, parent);
    }/*from   w  w  w  .  ja  va  2 s  .co  m*/
}

From source file:tool.GraphMutable.java

public GraphMutable() {
    left = HashMultimap.create();
    right = HashMultimap.create();
}

From source file:vazkii.botania.common.item.equipment.armor.terrasteel.ItemTerrasteeelArmor.java

@Override
public Multimap getItemAttributeModifiers() {
    Multimap map = HashMultimap.create();
    map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(),
            new AttributeModifier(new UUID(171328 /** Random number **/
                    , armorType), "Armor modifier" + armorType, getHealthBoost(), 0));
    return map;//w  w  w . j a  va  2s.  c  o m
}

From source file:org.eclipse.xtext.mwe.PathTraverser.java

public Multimap<String, URI> resolvePathes(List<String> pathes, Predicate<URI> isValidPredicate) {
    Multimap<String, URI> uris = HashMultimap.create();
    for (String path : pathes) {
        Set<URI> resourceUris = findAllResourceUris(path, isValidPredicate);
        uris.putAll(path, resourceUris);
    }/*from  w ww  .j  a  v a 2  s  .c  o  m*/
    return uris;
}

From source file:de.unidue.inf.is.ezdl.dlcore.analysis.stopwords.DefaultStopwordFilter.java

public DefaultStopwordFilter() {
    stopwords = HashMultimap.create();
    try {//  w ww .j  a  va 2 s .co m
        readStopwordList(Locale.ENGLISH, "/stopwords/english");
        readStopwordList(Locale.GERMAN, "/stopwords/german");
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
    }
}