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.jclouds.azurecompute.arm.domain.ExtensionProperties.java

@SerializedNames({ "publisher", "type", "typeHandlerVersion", "autoUpgradeMinorVersion", "settings",
        "protectedSettings" })
public static ExtensionProperties create(final String publisher, String type, final String typeHandlerVersion,
        final Boolean autoUpgradeMinorVersion, final ExtensionProfileSettings settings,
        final Map<String, String> protectedSettings) {
    return new AutoValue_ExtensionProperties(publisher, type, typeHandlerVersion, autoUpgradeMinorVersion,
            settings, protectedSettings == null ? ImmutableMap.<String, String>of()
                    : ImmutableMap.copyOf(protectedSettings));
}

From source file:net.anyflow.lannister.topic.Topics.java

public ImmutableMap<String, Topic> map() {
    return ImmutableMap.copyOf(topics);
}

From source file:com.facebook.buck.testutil.integration.TarInspector.java

private static ImmutableMap<String, byte[]> readTar(Optional<String> compressorType, Path tar)
        throws IOException, CompressorException {

    HashMap<String, byte[]> result = new HashMap<>();

    try (TarArchiveInputStream archiveStream = getArchiveInputStream(compressorType, tar)) {
        TarArchiveEntry entry;//from w ww.  jav  a 2s. co m
        while ((entry = archiveStream.getNextTarEntry()) != null) {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ByteStreams.copy(archiveStream, buffer);
            result.put(entry.getName(), buffer.toByteArray());
        }
    }

    return ImmutableMap.copyOf(result);
}

From source file:appeng.client.render.model.BuiltInModelLoader.java

public BuiltInModelLoader(Map<String, IModel> builtInModels) {
    this.builtInModels = ImmutableMap.copyOf(builtInModels);
}

From source file:com.facebook.buck.core.model.targetgraph.TargetGraphFactory.java

/**
 * Like {@link #newInstance(TargetNode[])} but does not also add a node for unflavored version of
 * the given node./*from  w w  w  .  j av a2s . c  o  m*/
 */
public static TargetGraph newInstanceExact(TargetNode<?>... nodes) {
    Map<BuildTarget, TargetNode<?>> builder = new HashMap<>();
    for (TargetNode<?> node : nodes) {
        builder.put(node.getBuildTarget(), node);
    }
    ImmutableMap<BuildTarget, TargetNode<?>> map = ImmutableMap.copyOf(builder);

    MutableDirectedGraph<TargetNode<?>> graph = new MutableDirectedGraph<>();
    for (TargetNode<?> node : map.values()) {
        graph.addNode(node);
        for (BuildTarget dep : node.getBuildDeps()) {
            graph.addEdge(node, Objects.requireNonNull(map.get(dep), dep::toString));
        }
    }
    return new TargetGraph(graph, map);
}

From source file:org.jclouds.googlecomputeengine.handlers.MetadataBinder.java

/**
 * {@inheritDoc}/* ww  w . ja v  a 2  s.  com*/
 */
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
    Map<String, String> items = ImmutableMap
            .copyOf((Map<String, String>) checkNotNull(postParams.get("items"), "item"));
    String fingerprint = (String) checkNotNull(postParams.get("fingerprint"), "fingerprint");
    Metadata metadata = Metadata.builder().fingerprint(fingerprint).items(items).build();
    return bindToRequest(request, metadata);
}

From source file:com.teradata.tempto.fulfillment.ldap.LdapObjectDefinition.java

private LdapObjectDefinition(String id, String distinguishedName, Map<String, String> attributes,
        Map<String, List<String>> modificationAttributes, List<String> objectClasses) {
    this.id = requireNonNull(id, "id is null");
    this.distinguishedName = requireNonNull(distinguishedName, "distinguishedName is null");
    this.attributes = ImmutableMap.copyOf(requireNonNull(attributes, "attributes is null"));
    this.modificationAttributes = ImmutableMap
            .copyOf(requireNonNull(modificationAttributes, "modificationAttributes is null"));
    this.objectClasses = ImmutableList.copyOf(requireNonNull(objectClasses, "objectClasses is null"));
}

From source file:com.facebook.buck.apple.xcode.plist.PlistDictionary.java

public ImmutableMap<String, PlistValue> asMap() {
    return ImmutableMap.copyOf(value);
}

From source file:com.facebook.buck.core.build.engine.impl.FakeBuildEngine.java

public FakeBuildEngine(Map<BuildTarget, BuildResult> buildResults) {
    this.buildResults = ImmutableMap.copyOf(buildResults);
}

From source file:co.cask.cdap.data.stream.service.upload.BufferedContentWriterFactory.java

public BufferedContentWriterFactory(Id.Stream streamId, ConcurrentStreamWriter streamWriter,
        Map<String, String> headers) {
    this.streamId = streamId;
    this.streamWriter = streamWriter;
    this.headers = ImmutableMap.copyOf(headers);
}