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:org.opendaylight.mdsal.dom.spi.shard.WriteableNodeWithSubshard.java

protected WriteableNodeWithSubshard(final Map<PathArgument, WriteableModificationNode> children) {
    this.children = ImmutableMap.copyOf(children);
}

From source file:org.jclouds.aliyun.ecs.domain.ResourceInfo.java

@SerializedNames({ "IoOptimized", "SystemDiskCategories", "InstanceTypes", "InstanceTypeFamilies",
        "DataDiskCategories", "InstanceGenerations", "NetworkTypes" })
public static ResourceInfo create(boolean ioOptimized, Map<String, List<String>> systemDiskCategories,
        Map<String, List<String>> instanceTypes, Map<String, List<String>> instanceTypeFamilies,
        Map<String, List<String>> dataDiskCategories, Map<String, List<String>> instanceGenerations,
        Map<String, List<String>> networkTypes) {
    return new AutoValue_ResourceInfo(ioOptimized,
            systemDiskCategories == null ? ImmutableMap.<String, List<String>>of()
                    : ImmutableMap.copyOf(systemDiskCategories),
            instanceTypes == null ? ImmutableMap.<String, List<String>>of()
                    : ImmutableMap.copyOf(instanceTypes),
            instanceTypeFamilies == null ? ImmutableMap.<String, List<String>>of()
                    : ImmutableMap.copyOf(instanceTypeFamilies),
            dataDiskCategories == null ? ImmutableMap.<String, List<String>>of()
                    : ImmutableMap.copyOf(dataDiskCategories),
            instanceGenerations == null ? ImmutableMap.<String, List<String>>of()
                    : ImmutableMap.copyOf(instanceGenerations),
            networkTypes == null ? ImmutableMap.<String, List<String>>of() : ImmutableMap.copyOf(networkTypes));
}

From source file:net.ltgt.guice.neo4j.Neo4jIndexProviders.java

public static Provider<Index<Node>> indexForNodes(final String name, Map<String, String> config) {
    Preconditions.checkArgument(!Strings.isNullOrEmpty(name));
    Preconditions.checkNotNull(config);//from   w w w .  j  a  v  a  2s. c om

    final Map<String, String> configToUse = ImmutableMap.copyOf(config);

    return new Provider<Index<Node>>() {

        @Inject
        IndexManager indexManager;

        @Override
        public Index<Node> get() {
            return indexManager.forNodes(name, configToUse);
        }
    };
}

From source file:com.facebook.buck.util.MoreMaps.java

public static <K, V> ImmutableMap<K, V> merge(Map<K, V> first, Map<K, V> second) {
    Map<K, V> mutableMap = new HashMap<>(first);
    mutableMap.putAll(second);/*from  w  w  w .  j av  a  2s .c  o m*/
    return ImmutableMap.copyOf(mutableMap);
}

From source file:org.marketcetera.core.position.ImmutablePositionSupport.java

/**
 * Constructor.//from   w  w  w .ja  va 2s  .co m
 * 
 * @param positions
 *            a map of positions, cannot be null, cannot have any null keys or values
 */
public ImmutablePositionSupport(Map<? extends PositionKey<?>, BigDecimal> positions) {
    mPositions = ImmutableMap.copyOf(positions);
}

From source file:forms.meta.MetaMap.java

private MetaMap(Map<MetaField<?>, Object> map) {
    this.map = ImmutableMap.copyOf(map);
}

From source file:com.blacklocus.misc.NoNullsMap.java

public static <K, V> ImmutableMap<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) {
    NoNullsMap<K, V> map = new NoNullsMap<K, V>(3);
    map.put(k1, v1);/*from w ww.  j a  v  a  2s. c om*/
    map.put(k2, v2);
    map.put(k3, v3);
    map.put(k4, v4);
    return ImmutableMap.copyOf(map);
}

From source file:io.datakernel.logfs.LogPositions.java

public LogPositions(Map<String, LogPosition> positions) {
    this.positions = ImmutableMap.copyOf(positions);
}

From source file:org.jclouds.azurecompute.arm.domain.NetworkInterfaceCard.java

@SerializedNames({ "name", "id", "etag", "location", "properties", "tags" })
public static NetworkInterfaceCard create(final String name, final String id, final String etag,
        final String location, final NetworkInterfaceCardProperties properties,
        final Map<String, String> tags) {
    return new AutoValue_NetworkInterfaceCard(name, id, etag, location, properties,
            tags != null ? ImmutableMap.copyOf(tags) : null);
}

From source file:dagger.android.processor.AndroidMapKeys.java

/**
 * Returns the Android framework types available to the compiler, keyed by their associated {@code
 * dagger.android} {@link MapKey}s. This will always contain the types that are defined by the
 * framework, and only contain the support library types if they are on the classpath of the
 * current compilation./*w  ww. ja  v a 2s . c  o  m*/
 */
static ImmutableMap<Class<? extends Annotation>, TypeMirror> annotationsAndFrameworkTypes(Elements elements) {
    return ImmutableMap.copyOf(Stream
            .of(elements.getPackageElement("dagger.android"),
                    elements.getPackageElement("dagger.android.support"))
            .filter(Objects::nonNull)
            .flatMap(packageElement -> typesIn(packageElement.getEnclosedElements()).stream())
            .filter(type -> MoreElements.isAnnotationPresent(type, MapKey.class))
            .filter(mapKey -> mapKey.getAnnotation(MapKey.class).unwrapValue())
            .flatMap(AndroidMapKeys::classForAnnotationElement)
            .collect(toMap(key -> key, key -> mapKeyValue(key, elements))));
}