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

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

Introduction

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

Prototype

public static <K, V> ImmutableMap<K, V> copyOf(Iterable<? extends Entry<? extends K, ? extends V>> entries) 

Source Link

Usage

From source file:io.airlift.discovery.store.StoreResource.java

@Inject
public StoreResource(Map<String, LocalStore> localStores, Map<String, StoreConfig> configs) {
    this.localStores = ImmutableMap.copyOf(localStores);
    this.tombstoneMaxAges = ImmutableMap
            .copyOf(Maps.transformValues(configs, new Function<StoreConfig, Duration>() {
                @Override/* ww  w. ja  v  a2s.  com*/
                public Duration apply(@Nullable StoreConfig config) {
                    return config.getTombstoneMaxAge();
                }
            }));
}

From source file:org.opendaylight.yangtools.yang.data.impl.schema.nodes.UnmodifiableChildrenMap.java

/**
 * Create an unmodifiable view of a particular map. Does not perform unnecessary
 * encapsulation if the map is known to be already unmodifiable.
 *
 * @param map Backing map/* www .  ja  va 2s.c om*/
 * @return Unmodifiable view
 */
static Map<PathArgument, DataContainerChild<? extends PathArgument, ?>> create(
        final Map<PathArgument, DataContainerChild<? extends PathArgument, ?>> map) {
    if (map instanceof UnmodifiableChildrenMap) {
        return map;
    }
    if (map instanceof ImmutableMap) {
        return map;
    }
    if (map.isEmpty()) {
        return ImmutableMap.of();
    }
    if (map.size() < WRAP_THRESHOLD) {
        return ImmutableMap.copyOf(map);
    }

    return new UnmodifiableChildrenMap(map);
}

From source file:org.trancecode.xproc.event.BeforeEvaluateVariableEvent.java

public BeforeEvaluateVariableEvent(final Step pipeline, final Step step, final Variable variable,
        final XdmNode xpathContextNode, final Map<QName, String> inScopeVariables) {
    super(pipeline, step, variable);
    this.xpathContextNode = xpathContextNode;
    this.inScopeVariables = ImmutableMap.copyOf(inScopeVariables);
}

From source file:com.google.devtools.build.lib.syntax.LoadStatement.java

/**
 * Constructs an import statement.//from ww w  .j a v  a2 s. c  o  m
 *
 * <p>{@code symbols} maps a symbol to the original name under which it was defined in
 * the bzl file that should be loaded. If aliasing is used, the value differs from its key's
 * {@code symbol.getName()}. Otherwise, both values are identical.
 */
LoadStatement(StringLiteral imp, Map<Identifier, String> symbols) {
    this.imp = imp;
    this.symbols = ImmutableMap.copyOf(symbols);
    this.cachedSymbols = ImmutableList.copyOf(symbols.keySet());
}

From source file:com.facebook.presto.sql.planner.assertions.SymbolAliases.java

private SymbolAliases(Map<String, SymbolReference> aliases) {
    this.map = ImmutableMap.copyOf(aliases);
}

From source file:org.gaul.s3proxy.S3Exception.java

S3Exception(S3ErrorCode error, String message, Throwable cause, Map<String, String> elements) {
    super(requireNonNull(message), cause);
    this.error = requireNonNull(error);
    this.elements = ImmutableMap.copyOf(elements);
}

From source file:com.github.fge.jsonpatch.diff.DiffProcessor.java

DiffProcessor(final Map<JsonPointer, JsonNode> unchanged) {
    this.unchanged = ImmutableMap.copyOf(unchanged);
}

From source file:com.google.devtools.build.lib.analysis.test.ExecutionInfo.java

public ExecutionInfo(Map<String, String> requirements) {
    super(PROVIDER, ImmutableMap.<String, Object>of("requirements", requirements));
    this.executionInfo = ImmutableMap.copyOf(requirements);
}

From source file:org.apache.twill.internal.DefaultEventHandlerSpecification.java

public DefaultEventHandlerSpecification(EventHandler eventHandler) {
    EventHandlerSpecification spec = eventHandler.configure();
    this.className = eventHandler.getClass().getName();
    this.configs = ImmutableMap.copyOf(spec.getConfigs());
}

From source file:com.facebook.presto.execution.QueryQueueRule.java

QueryQueueRule(@Nullable Pattern userRegex, @Nullable Pattern sourceRegex,
        Map<String, Pattern> sessionPropertyRegexes, List<QueryQueueDefinition> queues) {
    this.userRegex = userRegex;
    this.sourceRegex = sourceRegex;
    this.sessionPropertyRegexes = ImmutableMap
            .copyOf(requireNonNull(sessionPropertyRegexes, "sessionPropertyRegexes is null"));
    requireNonNull(queues, "queues is null");
    checkArgument(!queues.isEmpty(), "queues is empty");
    this.queues = ImmutableList.copyOf(queues);
}