Example usage for com.google.common.collect ImmutableMultimap copyOf

List of usage examples for com.google.common.collect ImmutableMultimap copyOf

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableMultimap copyOf.

Prototype

@Beta
public static <K, V> ImmutableMultimap<K, V> copyOf(
        Iterable<? extends Entry<? extends K, ? extends V>> entries) 

Source Link

Document

Returns an immutable multimap containing the specified entries.

Usage

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 {/*  w w  w .  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:org.lanternpowered.server.world.chunk.LanternChunkTicketManager.java

/**
 * Gets all the registered callbacks.//from   w  w  w . j a  v a2 s  .  co  m
 * 
 * @return The callbacks
 */
public Multimap<String, Callback> getCallbacks() {
    return ImmutableMultimap.copyOf(this.callbacks);
}

From source file:org.chaston.oakfunds.storage.RecordTypeRegistryImpl.java

@Inject
RecordTypeRegistryImpl(Set<RecordType> recordTypes) {
    Map<String, RecordType> recordTypesBuilder = new HashMap<>();
    Map<String, RecordValidator> recordValidatorsBuilder = new HashMap<>();
    Multimap<String, RecordType> assignableRecordTypesBuilder = MultimapBuilder.hashKeys().hashSetValues()
            .build();/*w w  w.j av a2s .  com*/
    for (RecordType recordType : recordTypes) {
        if (recordTypesBuilder.containsKey(recordType.getName())) {
            throw new IllegalStateException(
                    "RecordType " + recordType.getName() + " was bound more than once.");
        }
        recordTypesBuilder.put(recordType.getName(), recordType);
        recordValidatorsBuilder.put(recordType.getName(), new RecordValidator(recordType));
        assignableRecordTypesBuilder.put(recordType.getName(), recordType);
        RecordType parentType = recordType.getParentType();
        while (parentType != null) {
            assignableRecordTypesBuilder.put(parentType.getName(), recordType);
            parentType = parentType.getParentType();
        }
    }
    this.recordTypes = ImmutableMap.copyOf(recordTypesBuilder);
    this.recordValidators = ImmutableMap.copyOf(recordValidatorsBuilder);
    this.assignableRecordTypes = ImmutableMultimap.copyOf(assignableRecordTypesBuilder);
}

From source file:io.wcm.caravan.io.http.request.CaravanHttpRequest.java

/**
 * @param serviceId Logical name of the request service. Used by {@link CaravanHttpClient} to resolve the real URL.
 *          If null, only {@code url} is used
 * @param method HTTP method verb// w w  w. j  a va 2  s  .c o m
 * @param url Service request URL. Can be an absolute URL or just an path getting combined with the URL of the logical
 *          service ID
 * @param headers HTTP headers
 * @param body HTTP Payload
 * @param charset Payload charset
 */
CaravanHttpRequest(final String serviceId, final String method, final String url,
        final Multimap<String, String> headers, final byte[] body, final Charset charset) {
    this.serviceId = serviceId; // nullable
    this.method = checkNotNull(method, "method of %s", url);
    this.url = checkNotNull(url, "url");
    this.headers = ImmutableMultimap
            .copyOf(LinkedHashMultimap.create(checkNotNull(headers, "headers of %s %s", method, url)));
    this.body = body; // nullable
    this.charset = charset; // nullable
    this.performanceMetrics = PerformanceMetrics
            .createNew(StringUtils.defaultString(serviceId, "UNKNOWN SERVICE") + " : "
                    + StringUtils.defaultString(method, "UNKNOWN METHOD"), url, getCorrelationId());
}

From source file:org.jclouds.openstack.keystone.v1_1.domain.Auth.java

public Auth(Token token, Multimap<String, Endpoint> serviceCatalog) {
    this.token = checkNotNull(token, "token");
    this.serviceCatalog = ImmutableMultimap.copyOf(checkNotNull(serviceCatalog, "serviceCatalog"));
}

From source file:org.opendaylight.controller.sal.binding.impl.ListenerMapGeneration.java

ListenerMapGeneration(
        final Multimap<Class<? extends Notification>, NotificationListenerRegistration<?>> listeners) {
    this.typeToListeners = ImmutableMultimap.copyOf(listeners);
}

From source file:eu.esdihumboldt.hale.server.templates.TemplateProject.java

/**
 * @return the resources
 */
public Multimap<String, Resource> getResources() {
    return ImmutableMultimap.copyOf(resources);
}

From source file:cosmos.util.IndexHelper.java

public Multimap<Column, Index> columnIndices() {
    return ImmutableMultimap.copyOf(this.columnsToIndex);
}

From source file:ps3joiner.Main.java

/**
 * @return a MultiMap where each key is the Path to a whole file, and the values are the partial files, sorted by name
 *///from   w  w  w .  ja v a  2 s  .  com
public static ImmutableMultimap<Path, Path> findFilesToJoin(final Path path) throws IOException {
    final Map<Path, Path> splitToWholeFileMapping = new HashMap<>();

    final SplitFilesVisitor visitor = new SplitFilesVisitor();
    Files.walkFileTree(path, visitor);
    final List<Path> foundPaths = visitor.foundPaths();
    for (final Path foundPath : foundPaths) {
        final Path originalFilePath = findOriginalFileFromSplitFile(foundPath);
        splitToWholeFileMapping.put(foundPath, originalFilePath);
    }

    final Multimap<Path, Path> multimap = TreeMultimap.create();
    for (final Entry<Path, Path> entry : splitToWholeFileMapping.entrySet()) {
        final Path splitFilePath = entry.getKey();
        final Path wholeFilePath = entry.getValue();

        multimap.put(wholeFilePath, splitFilePath);
    }
    return ImmutableMultimap.copyOf(multimap);
}

From source file:com.qcadoo.mes.basic.shift.ShiftTimetableExceptions.java

private ImmutableMultimap<TimetableExceptionType, DateRange> getExceptions(final Entity shift) {
    List<Entity> timetableExceptionEntities = shift.getHasManyField(ShiftFields.TIMETABLE_EXCEPTIONS);
    return ImmutableMultimap.copyOf(Multimaps
            .transformValues(Multimaps.index(timetableExceptionEntities, EXTRACT_TYPE), EXTRACT_DATE_RANGE));
}