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

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

Introduction

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

Prototype

Collection<Map.Entry<K, V>> entries();

Source Link

Document

Returns a view collection of all key-value pairs contained in this multimap, as Map.Entry instances.

Usage

From source file:org.seedstack.seed.core.internal.AbstractSeedModule.java

/**
 * Binds typeLiterals to their implementations using the qualifier when it exists.
 * <p>//from w w w  . ja  va2 s . c o m
 * For instance:
 * <pre>
 * class MyClassA extends MySuperClass&lt;TypeGenericA&gt; {...}
 *
 * {@literal @}Inject
 * MySuperClass&lt;TypeGenericA&gt; &lt;- MyClassA
 *
 * class MyClassB extends MySuperClass&lt;TypeGenericB&gt; {...}
 *
 * {@literal @}Inject
 * MySuperClass&lt;TypeGenericB&gt; &lt;- MyClassB
 * </pre>
 *
 * If a {@link javax.inject.Qualifier} is specified on the implementation, it will
 * be used in the bound {@link com.google.inject.Key}.
 * <p>
 * For instance, if {@code MyClassC} is annotated by a qualifier:
 * <pre>
 * {@literal @}Named("C")
 * class MyClassC extends MySuperClass&lt;TypeGenericA&gt; {
 *     ...
 * }
 * </pre>
 * Then, the qualifier should be used specified at the injection point.
 * <pre>
 * {@literal @}Inject @Named("C")
 * MySuperClass&lt;TypeGenericA&gt; &lt;- MyClassC
 * </pre>
 *
 * @param bindingsMap classes to bind
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void bindTypeLiterals(Multimap<TypeLiteral<?>, Class<?>> bindingsMap) {
    for (Entry<TypeLiteral<?>, Class<?>> entry : bindingsMap.entries()) {
        TypeLiteral<?> typeLiteral = entry.getKey();
        Class classToBind = entry.getValue();
        Annotation annotation = SeedReflectionUtils.getAnnotationMetaAnnotatedFromAncestor(classToBind,
                Qualifier.class);
        if (annotation != null) {
            bind(Key.get(typeLiteral, annotation)).to(classToBind);
        } else {
            bind(typeLiteral).to(classToBind);
        }
    }
}

From source file:ru.jts_dev.gameserver.parser.html.HtmlRepository.java

@PostConstruct
private void loadHtm() throws IOException {
    htmlDir = Paths.get(resourceLoader.getResource("html").getURI());
    Multimap<Locale, Path> htmlToLoad = config.getType().htmlToLoad(resourceLoader, htmlDir);
    htmlToLoad.entries().forEach(entry -> getHtml(entry.getKey(), entry.getValue().toString()));
}

From source file:org.jclouds.openstack.swift.v1.functions.EntriesWithoutMetaPrefix.java

@Override
public Map<String, String> apply(Multimap<String, String> arg0) {
    ImmutableMap.Builder<String, String> metadata = ImmutableMap.builder();
    for (Entry<String, String> header : arg0.entries()) {
        int index = header.getKey().indexOf("-Meta-");
        if (index != -1) {
            metadata.put(header.getKey().substring(index + 6), header.getValue());
        }/*from w  ww .ja  v a 2 s  .c om*/
    }
    return metadata.build();
}

From source file:grakn.core.graql.reasoner.unifier.UnifierImpl.java

public UnifierImpl(Multimap<Variable, Variable> map) {
    this(map.entries());
}

From source file:com.tinspx.util.io.charset.AbstractHeaderCharDet.java

@Override
public void onHeaders(Multimap<String, String> headers) {
    if (complete) {
        return;/* w  w  w  .  j a  va2 s .  co  m*/
    }
    for (Map.Entry<String, String> e : headers.entries()) {
        onHeader(e.getKey(), e.getValue());
        if (complete) {
            break;
        }
    }
}

From source file:hu.bme.mit.incqueryd.engine.rete.nodes.TypeInputNode.java

private void initializeEdge(final String typeName, RDFGraphDriverRead driver) throws IOException {
    Multimap<Resource, Resource> edges = driver.collectEdges(typeName);

    for (Entry<Resource, Resource> edge : edges.entries()) {
        tuples.add(new Tuple(edge.getKey().stringValue(), edge.getValue().stringValue()));
    }/*from w ww  .j  a  v a2  s .c o m*/
}

From source file:edu.cmu.lti.oaqa.framework.eval.retrieval.RetrievalMeasuresEvaluator.java

@Override
public void process(ExperimentKey experiment) throws AnalysisEngineProcessException {
    persistence.deleteFMeasureEval(experiment);
    Multimap<Key, RetrievalCounts> counts = persistence.retrievePartialCounts(experiment);
    for (Map.Entry<Key, RetrievalCounts> me : counts.entries()) {
        update(me.getKey(), me.getValue());
    }/* w  w w .j a va 2  s.  c o  m*/
    doEvaluate();
}

From source file:org.lanternpowered.server.asset.AbstractMultiAssetRepository.java

@Override
public Multimap<String, Asset> getAssetsMap(String path, boolean checkChildDirectories) {
    final Map<String, Map<String, Asset>> map = new HashMap<>();
    for (AssetRepository repository : getRepositories()) {
        final Multimap<String, Asset> multimap = repository.getAssetsMap(path, checkChildDirectories);
        multimap.entries().forEach(entry -> {
            final Map<String, Asset> entries = map.computeIfAbsent(entry.getKey(), key -> new HashMap<>());
            entries.putIfAbsent(entry.getValue().getId(), entry.getValue());
        });/* w w w .j  a va2  s . co m*/
    }
    final ImmutableMultimap.Builder<String, Asset> builder = ImmutableMultimap.builder();
    map.entrySet().forEach(entry -> builder.putAll(entry.getKey(), entry.getValue().values()));
    return builder.build();
}

From source file:edu.cmu.lti.oaqa.framework.eval.passage.PassageMAPMeasuresEvaluator.java

@Override
public void process(ExperimentKey experiment) throws AnalysisEngineProcessException {
    persistence.deletePassageMeasureEval(experiment);
    Multimap<Key, PassageMAPCounts> counts = persistence.retrievePartialCounts(experiment);
    for (Map.Entry<Key, PassageMAPCounts> me : counts.entries()) {
        update(me.getKey(), me.getValue());
    }/*from  w  w w . ja  v a2  s  .  com*/
    doEvaluate();
}

From source file:org.sosy_lab.cpachecker.core.defaults.precision.LocalizedRefinablePrecision.java

@Override
public LocalizedRefinablePrecision withIncrement(Multimap<CFANode, MemoryLocation> increment) {
    if (this.rawPrecision.entries().containsAll(increment.entries())) {
        return this;
    } else {/*ww w.ja v  a2s.  c  o  m*/
        // sorted multimap so that we have deterministic output
        SetMultimap<CFANode, MemoryLocation> refinedPrec = TreeMultimap.create(rawPrecision);
        refinedPrec.putAll(increment);

        return new LocalizedRefinablePrecision(super.getBaseline(), ImmutableMultimap.copyOf(refinedPrec));
    }
}