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

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

Introduction

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

Prototype

public static <K extends Comparable, V extends Comparable> TreeMultimap<K, V> create(
        Multimap<? extends K, ? extends V> multimap) 

Source Link

Document

Constructs a TreeMultimap , ordered by the natural ordering of its keys and values, with the same mappings as the specified multimap.

Usage

From source file:org.kairosdb.core.datastore.AbstractDataPointGroup.java

public AbstractDataPointGroup(String name, SetMultimap<String, String> tags) {
    this.name = Preconditions.checkNotNullOrEmpty(name);
    this.tags = TreeMultimap.create(tags);
}

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 {/*from   w  ww  . j  av  a 2 s  . 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));
    }
}

From source file:com.facebook.buck.cli.OwnersReport.java

OwnersReport updatedWith(OwnersReport other) {
    SetMultimap<TargetNode<?, ?>, Path> updatedOwners = TreeMultimap.create(owners);
    updatedOwners.putAll(other.owners);/*ww  w.  java2  s.  c  om*/

    return new OwnersReport(updatedOwners, Sets.intersection(inputsWithNoOwners, other.inputsWithNoOwners),
            Sets.union(nonExistentInputs, other.nonExistentInputs),
            Sets.union(nonFileInputs, other.nonFileInputs));
}

From source file:com.facebook.buck.android.StringResources.java

public StringResources getMergedResources(StringResources otherResources) {
    TreeMap<Integer, String> stringsMap = Maps.newTreeMap(otherResources.strings);
    TreeMap<Integer, ImmutableMap<String, String>> pluralsMap = Maps.newTreeMap(otherResources.plurals);
    TreeMultimap<Integer, String> arraysMap = TreeMultimap.create(otherResources.arrays);

    stringsMap.putAll(strings);/*from   w  w w .  ja v  a 2  s. c  o  m*/
    pluralsMap.putAll(plurals);
    arraysMap.putAll(arrays);

    return new StringResources(stringsMap, pluralsMap, arraysMap);
}

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

@Override
public VariableTrackingPrecision join(VariableTrackingPrecision consolidatedPrecision) {
    checkArgument(getClass().equals(consolidatedPrecision.getClass()));
    checkArgument(//from   w  ww  .  j a  v  a  2 s  . c  om
            super.getBaseline().equals(((LocalizedRefinablePrecision) consolidatedPrecision).getBaseline()));

    SetMultimap<CFANode, MemoryLocation> joinedPrec = TreeMultimap.create(rawPrecision);
    joinedPrec.putAll(((LocalizedRefinablePrecision) consolidatedPrecision).rawPrecision);
    return new LocalizedRefinablePrecision(super.getBaseline(), ImmutableMultimap.copyOf(joinedPrec));
}

From source file:hub.backends.users.types.Person.java

public void setRoles(Multimap<String, String> roles) {
    this.roles = TreeMultimap.create(roles);
}

From source file:hub.backends.users.types.Person.java

public void setUsernames(Multimap<String, String> usernames) {
    this.usernames = TreeMultimap.create(usernames);

}

From source file:sadl.models.pdrta.Interval.java

/**
 * Creates a deep copy of the given interval. It does not copy the {@link TimedTail}s from the {@link PDRTAInput}.
 * /*from  w  w  w  . ja  va2 s.  c  o m*/
 * @param in
 *            Interval to be copied
 */
protected Interval(Interval in) {

    begin = in.begin;
    end = in.end;
    tails = TreeMultimap.create(in.tails);
    target = in.target;
}

From source file:org.jclouds.aws.filters.FormSigner.java

@VisibleForTesting
String buildCanonicalizedString(Multimap<String, String> decodedParams) {
    // note that aws wants to percent encode the canonicalized string without skipping '/' and '?'
    return encodeQueryLine(TreeMultimap.create(decodedParams), ImmutableList.<Character>of());
}

From source file:org.voltdb.sysprocs.saverestore.StreamSnapshotWritePlan.java

/**
 * Pick one (source, destination) pair from each stream for replicated table data transfer.
 * Picking multiple pairs from each stream will result in duplicated replicated table data.
 *
 * @param streams//from   w w  w . j a  va2  s .c  om
 * @return A map of (source, destination)
 */
private Multimap<Long, Long> pickOnePairPerStream(Collection<StreamSnapshotRequestConfig.Stream> streams) {
    Multimap<Long, Long> replicatedSrcToDst = HashMultimap.create();

    for (StreamSnapshotRequestConfig.Stream stream : streams) {
        // Use a tree map so that it's deterministic across nodes
        TreeMultimap<Long, Long> partitionStreamPairs = TreeMultimap.create(stream.streamPairs);
        Entry<Long, Long> candidate = partitionStreamPairs.entries().iterator().next();
        replicatedSrcToDst.put(candidate.getKey(), candidate.getValue());
    }

    return replicatedSrcToDst;
}