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

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

Introduction

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

Prototype

public final ImmutableSet<Entry<K, V>> entrySet() 

Source Link

Usage

From source file:com.google.devtools.build.lib.bazel.rules.android.ndkcrosstools.r11.AndroidNdkCrosstoolsR11.java

private static ImmutableList<DefaultCpuToolchain> getDefaultCpuToolchains(StlImpl stlImpl) {
    // TODO(bazel-team): It would be better to auto-generate this somehow.

    ImmutableMap<String, String> defaultCpus = ImmutableMap.<String, String>builder()
            // arm
            .put("armeabi", "arm-linux-androideabi-4.9").put("armeabi-v7a", "arm-linux-androideabi-4.9-v7a")
            .put("armeabi-v7a-hard", "arm-linux-androideabi-4.9-v7a-hard")
            .put("armeabi-thumb", "arm-linux-androideabi-4.9-thumb")
            .put("armeabi-v7a-thumb", "arm-linux-androideabi-4.9-v7a-thumb")
            .put("armeabi-v7a-hard-thumb", "arm-linux-androideabi-4.9-v7a-hard-thumb")
            .put("arm64-v8a", "aarch64-linux-android-4.9")

            // mips
            .put("mips", "mipsel-linux-android-4.9").put("mips64", "mips64el-linux-android-4.9")

            // x86
            .put("x86", "x86-4.9").put("x86_64", "x86_64-4.9").build();

    ImmutableList.Builder<DefaultCpuToolchain> defaultCpuToolchains = ImmutableList.builder();
    for (Entry<String, String> defaultCpu : defaultCpus.entrySet()) {
        defaultCpuToolchains.add(DefaultCpuToolchain.newBuilder().setCpu(defaultCpu.getKey())
                .setToolchainIdentifier(defaultCpu.getValue() + "-" + stlImpl.getName()).build());
    }/*from   w  w w .j a  v  a 2 s  .c o m*/
    return defaultCpuToolchains.build();
}

From source file:com.facebook.buck.parser.NonResolvingRawTargetNodeToTargetNodeFactory.java

private ImmutableMap<String, Object> assertRawTargetNodeAttributesNotConfigurable(BuildTarget buildTarget,
        ImmutableMap<String, Object> rawTargetNodeAttributes) {
    for (Map.Entry<String, ?> entry : rawTargetNodeAttributes.entrySet()) {
        Preconditions.checkState(!(entry.getValue() instanceof SelectorList),
                "Attribute %s cannot be configurable in %s", entry.getKey(), buildTarget);
    }/*from   w  w  w .  j  av a  2  s  .co m*/
    return rawTargetNodeAttributes;
}

From source file:io.atomix.utils.serializer.serializers.ImmutableMapSerializer.java

@Override
public void write(Kryo kryo, Output output, ImmutableMap<?, ?> object) {
    output.writeInt(object.size());/*  w w w  . j a  v a  2s.  c o  m*/
    for (Entry<?, ?> e : object.entrySet()) {
        kryo.writeClassAndObject(output, e.getKey());
        kryo.writeClassAndObject(output, e.getValue());
    }
}

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

/**
 * In a {@link BuckConfig}, an alias can either refer to a fully-qualified build target, or an
 * alias defined earlier in the {@code alias} section. The mapping produced by this method
 * reflects the result of resolving all aliases as values in the {@code alias} section.
 */// ww w .j  a  v  a2s  . c om
private static ImmutableMap<String, BuildTarget> createAliasToBuildTargetMap(
        ImmutableMap<String, String> rawAliasMap, BuildTargetParser buildTargetParser) {
    // We use a LinkedHashMap rather than an ImmutableMap.Builder because we want both (1) order to
    // be preserved, and (2) the ability to inspect the Map while building it up.
    LinkedHashMap<String, BuildTarget> aliasToBuildTarget = Maps.newLinkedHashMap();
    for (Map.Entry<String, String> aliasEntry : rawAliasMap.entrySet()) {
        String alias = aliasEntry.getKey();
        validateAliasName(alias);

        // Determine whether the mapping is to a build target or to an alias.
        String value = aliasEntry.getValue();
        BuildTarget buildTarget;
        if (isValidAliasName(value)) {
            buildTarget = aliasToBuildTarget.get(value);
            if (buildTarget == null) {
                throw new HumanReadableException("No alias for: %s.", value);
            }
        } else {
            // Here we parse the alias values with a BuildTargetParser to be strict. We could be looser
            // and just grab everything between "//" and ":" and assume it's a valid base path.
            try {
                buildTarget = buildTargetParser.parse(value, ParseContext.fullyQualified());
            } catch (NoSuchBuildTargetException e) {
                throw new HumanReadableException(e);
            }
        }
        aliasToBuildTarget.put(alias, buildTarget);
    }
    return ImmutableMap.copyOf(aliasToBuildTarget);
}

From source file:com.facebook.buck.rules.coercer.VersionMatchedCollection.java

private boolean matches(ImmutableMap<BuildTarget, Version> universe,
        ImmutableMap<BuildTarget, Version> versions) {
    for (Map.Entry<BuildTarget, Version> ent : versions.entrySet()) {
        Version existing = universe.get(ent.getKey());
        if (existing != null && !existing.equals(ent.getValue())) {
            return false;
        }//from   w  w w  . ja  va 2  s  . c o  m
    }
    return true;
}

From source file:com.google.template.soy.exprtree.MapLiteralNode.java

public MapLiteralNode(ImmutableMap<ExprNode, ExprNode> map, SourceLocation sourceLocation) {
    super(sourceLocation);
    for (Map.Entry<ExprNode, ExprNode> entry : map.entrySet()) {
        addChild(entry.getKey());/* w ww.ja  v a 2s .  c om*/
        addChild(entry.getValue());
    }
}

From source file:com.github.gv2011.util.icol.guava.AbstractIMapBuilder.java

@Override
public B tryPutAll(final Map<? extends K, ? extends V> map) {
    final ImmutableMap<K, V> copy = ImmutableMap.copyOf(map);
    synchronized (this.map) {
        copy.entrySet().stream().forEach(e -> this.map.putIfAbsent(notNull(e.getKey()), notNull(e.getValue())));
    }/*w w w  .  j a v a  2  s .co m*/
    return self();
}

From source file:com.github.gv2011.util.icol.guava.AbstractIMapBuilder.java

@Override
public B tryPutAll(final Collection<? extends Entry<? extends K, ? extends V>> map) {
    final ImmutableMap<K, V> copy = ImmutableMap.copyOf(map);
    synchronized (this.map) {
        copy.entrySet().stream().forEach(e -> this.map.putIfAbsent(notNull(e.getKey()), notNull(e.getValue())));
    }/*from   www .  j a va 2  s . c  om*/
    return self();
}

From source file:org.gradle.api.internal.changedetection.state.InputPropertiesSerializer.java

public void write(Encoder encoder, ImmutableMap<String, ValueSnapshot> properties) throws Exception {
    encoder.writeSmallInt(properties.size());
    for (Map.Entry<String, ValueSnapshot> entry : properties.entrySet()) {
        encoder.writeString(entry.getKey());
        writeSnapshot(encoder, entry.getValue());
    }/*from   www .j a v a 2  s.c  o  m*/
}

From source file:com.github.gv2011.util.icol.guava.AbstractIMapBuilder.java

@Override
public B putAll(final Map<? extends K, ? extends V> map) {
    final ImmutableMap<K, V> copy = ImmutableMap.copyOf(map);
    synchronized (this.map) {
        verify(copy.entrySet().stream()
                .allMatch(e -> e.getKey() != null && e.getValue() != null && !map.containsKey(e.getKey())));
        this.map.putAll(copy);
    }/*from www .j  ava  2s  .c  o  m*/
    return self();
}