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:co.cask.cdap.common.zookeeper.coordination.DefaultResourceAssigner.java

private DefaultResourceAssigner(Multimap<T, PartitionReplica> assignments) {
    this.assignments = assignments;
    this.replicaToHandler = Maps.newHashMap();
    for (Map.Entry<T, PartitionReplica> entry : assignments.entries()) {
        replicaToHandler.put(entry.getValue(), entry.getKey());
    }// w  w  w. j  a v  a 2s .c om
}

From source file:com.palantir.atlasdb.keyvalue.cassandra.CassandraExpiringKeyValueService.java

@Override
public void putWithTimestamps(String tableName, Multimap<Cell, Value> values, final long time,
        final TimeUnit unit) {
    try {//from w  w  w .  j  av a  2 s  .c o  m
        putInternal(tableName, values.entries(), CassandraKeyValueServices.convertTtl(time, unit));
    } catch (Exception e) {
        throw Throwables.throwUncheckedException(e);
    }
}

From source file:io.scigraph.services.jersey.dynamic.CypherInflector.java

Multimap<String, Object> resolveCuries(Multimap<String, Object> paramMap) {
    Multimap<String, Object> map = ArrayListMultimap.create();
    for (Entry<String, Object> entry : paramMap.entries()) {
        if (entry.getValue() instanceof String) {
            Optional<String> iri = curieUtil.getIri((String) entry.getValue());
            if (iri.isPresent()) {
                map.put(entry.getKey(), iri.get());
            } else {
                map.put(entry.getKey(), entry.getValue());
            }/*from  w ww.j a  v  a  2s.c  o m*/
        } else {
            map.put(entry.getKey(), entry.getValue());
        }
    }
    return map;
}

From source file:classes.Transaction.java

public Transaction(long time, Map<String, String> orderXmlParams, Multimap<String, Data> dbResult) {
    super(time);//from  w w  w  .  j av  a 2 s.c o  m
    parameters = Maps.newHashMap();
    if (orderXmlParams != null) {
        parameters.putAll(orderXmlParams);
    }
    parameters.putAll(dbResult.entries().stream().findFirst().get().getValue().getValues());
}

From source file:org.sonar.java.se.checks.SECheck.java

@Override
public void scanFile(JavaFileScannerContext context) {
    Multimap<Tree, DefaultJavaFileScannerContext.SEIssue> issues = ((DefaultJavaFileScannerContext) context)
            .getSEIssues(getClass());//from  w  w  w  .j a  v a2 s .co  m
    for (Map.Entry<Tree, DefaultJavaFileScannerContext.SEIssue> issue : issues.entries()) {
        DefaultJavaFileScannerContext.SEIssue seIssue = issue.getValue();
        context.reportIssue(this, seIssue.getTree(), seIssue.getMessage(), seIssue.getSecondary(), null);
    }
}

From source file:org.opendaylight.controller.netconf.confignetconfconnector.operations.editconfig.ReplaceEditConfigStrategy.java

private void addRefNames(ServiceRegistryWrapper services, Multimap<String, String> providedServices,
        ConfigTransactionClient ta, ObjectName on) throws InstanceNotFoundException {
    for (Entry<String, String> namespaceToService : providedServices.entries()) {

        if (services.hasRefName(namespaceToService.getKey(), namespaceToService.getValue(), on))
            continue;

        String refName = services.getNewDefaultRefName(namespaceToService.getKey(),
                namespaceToService.getValue(), ObjectNameUtil.getFactoryName(on),
                ObjectNameUtil.getInstanceName(on));
        ta.saveServiceReference(// w  w  w . ja  va 2 s  . c o  m
                ta.getServiceInterfaceName(namespaceToService.getKey(), namespaceToService.getValue()), refName,
                on);
    }
}

From source file:org.opendaylight.controller.md.sal.common.impl.routing.AbstractDataReadRouter.java

private Iterable<DataReader<P, D>> getReaders(Multimap<P, DataReaderRegistration<P, D>> readerMap, P path) {
    return FluentIterable.from(readerMap.entries()) //
            .filter(affects(path)) //
            .transform(retrieveInstance());
}

From source file:com.eincs.decanter.container.simple.route.SimpleRouter.java

@Override
public void remove(Object serviceObj) throws RouteReflectException {
    Multimap<SimpleRouteServiceId, SimpleRouteService> newServices = SimpleRouteService
            .createServices(serviceObj);
    for (Entry<SimpleRouteServiceId, SimpleRouteService> entry : newServices.entries()) {
        services.remove(entry.getKey(), entry.getValue());
    }// w w  w .java2 s  . c o  m
    resultCache.invalidateAll();
}

From source file:com.aestasit.markdown.slidery.converters.BaseConverter.java

private void copyStaticFiles(Multimap<String, File> staticFiles, File outputDir) throws IOException {
    for (Entry<String, File> templateFile : staticFiles.entries()) {
        String relativePath = templateFile.getKey();
        File destDir = new File(outputDir, relativePath);
        forceMkdir(destDir);/*  w w  w . ja  v a 2s  .c  om*/
        copyFileToDirectory(templateFile.getValue(), destDir);
    }
}

From source file:com.google.devtools.build.lib.rules.java.ProguardLibrary.java

/**
 * Collects the validated proguard specs exported by this rule and its dependencies through the
 * given attributes./*w w  w. j a va 2  s .co  m*/
 */
public NestedSet<Artifact> collectProguardSpecs(Multimap<Mode, String> attributes) {
    NestedSetBuilder<Artifact> specsBuilder = NestedSetBuilder.naiveLinkOrder();

    for (Entry<Mode, String> attribute : attributes.entries()) {
        specsBuilder.addTransitive(collectProguardSpecsFromAttribute(attribute.getValue(), attribute.getKey()));
    }

    Collection<Artifact> localSpecs = collectLocalProguardSpecs();
    if (!localSpecs.isEmpty()) {
        // Pass our local proguard configs through the validator, which checks a whitelist.
        FilesToRunProvider proguardWhitelister = ruleContext.getExecutablePrerequisite("$proguard_whitelister",
                Mode.HOST);
        for (Artifact specToValidate : localSpecs) {
            specsBuilder.add(validateProguardSpec(proguardWhitelister, specToValidate));
        }
    }

    return specsBuilder.build();
}