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.jfrog.teamcity.server.runner.BaseRunTypeConfigPropertiesProcessor.java

private void validatePublishedAndBuildDependencies(Collection<InvalidProperty> invalidProperties,
        String publishedAndBuildDependencies) {
    Multimap<String, String> pairs = PublishedItemsHelper
            .getPublishedItemsPatternPairs(publishedAndBuildDependencies);
    for (Map.Entry<String, String> patternEntry : pairs.entries()) {

        String sourcePattern = patternEntry.getKey().trim();

        if (!sourcePattern.contains(":")) {
            invalidProperties/*from ww  w.j a  v  a2  s.  co  m*/
                    .add(new InvalidProperty(RunnerParameterKeys.BUILD_DEPENDENCIES, getInvalidPatternMessage(
                            sourcePattern, "must be formatted like: [repo-key]:[pattern/to/search/for].")));
        } else if (!sourcePattern.contains("@") && sourcePattern.contains("**")
                && !sourcePattern.contains(";")) {
            invalidProperties.add(new InvalidProperty(RunnerParameterKeys.BUILD_DEPENDENCIES,
                    getInvalidPatternMessage(sourcePattern, "cannot contain the '**' wildcard.")));
        }
    }
}

From source file:com.palantir.atlasdb.cleaner.KeyValueServiceScrubberStore.java

@Override
public void markCellsAsScrubbed(Multimap<Cell, Long> cellToScrubTimestamp, int batchSize) {
    for (List<Entry<Cell, Long>> batch : Iterables.partition(cellToScrubTimestamp.entries(), batchSize)) {
        Multimap<Cell, Long> batchMultimap = HashMultimap.create();
        for (Entry<Cell, Long> e : batch) {
            batchMultimap.put(e.getKey(), e.getValue());
        }//from ww w  .j a  v a2s  .  com
        keyValueService.delete(AtlasDbConstants.SCRUB_TABLE, batchMultimap);
    }
}

From source file:org.jclouds.scriptbuilder.domain.SaveHttpResponseTo.java

/**
 * //w  w w  .j  a v  a2 s.  co m
 * @param dir
 *           location to save file
 * @param method
 *           http method: ex GET
 * @param endpoint
 *           uri corresponding to the request
 * @param headers
 *           request headers to send
 */
public SaveHttpResponseTo(String dir, String file, String method, URI endpoint,
        Multimap<String, String> headers) {
    super(String.format("({md} %s && {cd} %s && [ ! -f %s ] && %s -C - -X %s %s %s >%s)\n", dir, dir, file,
            CURL, method, Joiner.on(' ').join(
                    Iterables.transform(headers.entries(), new Function<Map.Entry<String, String>, String>() {

                        @Override
                        public String apply(Map.Entry<String, String> from) {
                            return String.format("-H \"%s: %s\"", from.getKey(), from.getValue());
                        }

                    })),
            endpoint.toASCIIString(), file));

}

From source file:ca.sqlpower.util.HashTreeSetMultimap.java

@Override
public boolean putAll(Multimap<? extends K, ? extends V> newValues) {
    for (Map.Entry<? extends K, ? extends V> entry : newValues.entries()) {
        put(entry.getKey(), entry.getValue());
    }/*from  w  ww.  j  av a2  s  .co m*/
    return false;
}

From source file:rabbit.data.internal.xml.access.AbstractAccessor.java

/**
 * Filters the given data.//  w w w.  j a  va  2 s  . c  om
 * 
 * @param data The raw data between the two dates of
 *          {@link #getData(LocalDate, LocalDate)}.
 * @return The filtered data.
 */
private Collection<T> filter(Multimap<WorkspaceStorage, S> data) {
    List<T> result = Lists.newLinkedList();
    for (Map.Entry<WorkspaceStorage, S> entry : data.entries()) {
        LocalDate date = toLocalDate(entry.getValue().getDate());
        for (E element : getElements(entry.getValue())) {
            T node = null;
            try {
                node = createDataNode(date, entry.getKey(), element);
            } catch (Exception e) {
                node = null;
            }
            if (node != null) {
                result.add(node);
            }
        }
    }
    return result;
}

From source file:fr.ujm.tse.lt2c.satin.rules.run.RunRHODF7a.java

@Override
protected int process(final TripleStore ts1, final TripleStore ts2, final Collection<Triple> outputTriples) {

    final long subClassOf = AbstractDictionary.subClassOf;

    int loops = 0;

    final Multimap<Long, Long> subpropertyMultiMap = ts2.getMultiMapForPredicate(subClassOf);
    if (subpropertyMultiMap != null && !subpropertyMultiMap.isEmpty()) {
        for (final Entry<Long, Long> entry : subpropertyMultiMap.entries()) {
            loops++;/*from w  w w .j a v  a  2s . c  om*/
            final Triple result1 = new ImmutableTriple(entry.getKey(), subClassOf, entry.getKey());
            final Triple result2 = new ImmutableTriple(entry.getValue(), subClassOf, entry.getValue());
            outputTriples.add(result1);
            outputTriples.add(result2);
        }
    }

    return loops;

}

From source file:org.jclouds.ohai.functions.NestSlashKeys.java

private Map<String, JsonBall> mergeSameKeys(Multimap<String, Supplier<JsonBall>> from) {
    Map<String, JsonBall> merged = Maps.newLinkedHashMap();
    for (Entry<String, Supplier<JsonBall>> entry : from.entries()) {
        if (merged.containsKey(entry.getKey())) {
            mergeAsPeer(entry.getKey(), entry.getValue().get(), merged);
        } else {//from   w  ww  .  j  av  a 2 s .  c  o m
            merged.put(entry.getKey(), entry.getValue().get());
        }
    }
    return merged;
}

From source file:org.eclipse.viatra.emf.runtime.transformation.eventdriven.EventDrivenTransformationRule.java

public EventDrivenTransformationRule(String name, IQuerySpecification<Matcher> precondition,
        Multimap<IncQueryActivationStateEnum, IMatchProcessor<Match>> stateActions,
        ActivationLifeCycle lifeCycle) {
    Set<Job<Match>> jobs = Sets.newHashSet();

    for (Entry<IncQueryActivationStateEnum, IMatchProcessor<Match>> stateAction : stateActions.entries()) {
        IncQueryActivationStateEnum state = stateAction.getKey();
        IMatchProcessor<Match> action = stateAction.getValue();

        jobs.add(Jobs.newStatelessJob(state, action));
    }// w  w w  . j a v a  2  s .c o m

    ruleSpecification = Rules.newMatcherRuleSpecification(precondition, lifeCycle, jobs);
}

From source file:com.google.devtools.build.lib.query2.output.PreciseAspectResolver.java

@Override
public ImmutableMultimap<Attribute, Label> computeAspectDependencies(Target target,
        DependencyFilter dependencyFilter) throws InterruptedException {
    Multimap<Attribute, Label> result = LinkedListMultimap.create();
    if (target instanceof Rule) {
        Multimap<Attribute, Label> transitions = ((Rule) target)
                .getTransitions(DependencyFilter.NO_NODEP_ATTRIBUTES);
        for (Entry<Attribute, Label> entry : transitions.entries()) {
            Target toTarget;//w  w w  .j a v a 2  s .  co m
            try {
                toTarget = packageProvider.getTarget(eventHandler, entry.getValue());
                result.putAll(AspectDefinition.visitAspectsIfRequired(target, entry.getKey(), toTarget,
                        dependencyFilter));
            } catch (NoSuchThingException e) {
                // Do nothing. One of target direct deps has an error. The dependency on the BUILD file
                // (or one of the files included in it) will be reported in the query result of :BUILD.
            }
        }
    }
    return ImmutableMultimap.copyOf(result);
}

From source file:fr.ujm.tse.lt2c.satin.rules.run.RunRHODF6b.java

@Override
protected int process(final TripleStore ts1, final TripleStore ts2, final Collection<Triple> outputTriples) {

    final long subPropertyOf = AbstractDictionary.subPropertyOf;

    int loops = 0;

    final Multimap<Long, Long> subpropertyMultimap = ts2.getMultiMapForPredicate(subPropertyOf);
    if (subpropertyMultimap != null && !subpropertyMultimap.isEmpty()) {
        for (final Entry<Long, Long> entry : subpropertyMultimap.entries()) {
            loops++;/*  w w w . j av a2 s  .  c o  m*/
            final Triple result1 = new ImmutableTriple(entry.getKey(), subPropertyOf, entry.getKey());
            final Triple result2 = new ImmutableTriple(entry.getValue(), subPropertyOf, entry.getValue());
            outputTriples.add(result1);
            outputTriples.add(result2);
        }
    }

    return loops;

}