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

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

Introduction

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

Prototype

@Override
    public boolean containsKey(@Nullable Object key) 

Source Link

Usage

From source file:com.facebook.buck.artifact_cache.AbstractArtifactCacheEventFactory.java

public static Optional<BuildTarget> getTarget(
        Function<String, UnconfiguredBuildTarget> unconfiguredBuildTargetFactory,
        TargetConfigurationSerializer targetConfigurationSerializer, ImmutableMap<String, String> metadata) {
    return metadata.containsKey(TARGET_KEY)
            ? getTarget(unconfiguredBuildTargetFactory, metadata.get(TARGET_KEY),
                    getTargetConfigurationFromMetadata(targetConfigurationSerializer, metadata))
            : Optional.empty();//ww  w  . j  a  v  a2  s.com
}

From source file:com.facebook.buck.artifact_cache.ArtifactCacheEvent.java

public static final Optional<String> getTarget(final ImmutableMap<String, String> metadata) {
    return metadata.containsKey(TARGET_KEY) ? Optional.of(metadata.get(TARGET_KEY)) : Optional.empty();
}

From source file:cz.cuni.mff.ms.brodecva.botnicek.ide.project.views.DefaultPrefixesSettingsTableModel.java

/**
 * Vytvo model, kter nastavuje pro dan prostory jmen dodan prefixy.
 * /*from  ww w.ja  va 2 s  . c o m*/
 * @param namespacesToPrefixes
 *            zobrazen URI prostor jmen na prefixy
 * @return model
 * @throws IllegalArgumentException
 *             pokud zobrazen neobsahuje poloky pro povinn prostory jmen
 */
public static DefaultPrefixesSettingsTableModel create(
        final Map<? extends URI, ? extends String> namespacesToPrefixes) {
    final ImmutableMap<URI, String> copy = ImmutableMap.copyOf(namespacesToPrefixes);

    Preconditions.checkArgument(copy.containsKey(URI.create(AIML.NAMESPACE_URI.getValue())));
    Preconditions.checkArgument(copy.containsKey(URI.create(XML.SCHEMA_NAMESPACE_URI.getValue())));

    return new DefaultPrefixesSettingsTableModel(namespacesToPrefixes);
}

From source file:com.spectralogic.ds3autogen.test.helpers.RemoveDollarSignConverterHelper.java

/**
 * Checks if a Type Map generated by the createPopulatedMap function has
 * successfully changed all type names by removing the '$' symbol
 *//*www.  j a  va 2 s .c om*/
public static void checkAutoPopulatedMap(final ImmutableMap<String, Ds3Type> map) {
    assertThat(map.size(), is(2));
    assertTrue(map.containsKey("com.test.package.Ds3Type_v1"));
    assertTrue(map.containsKey("com.test.package.Ds3Type_v2"));

    checkAutoPopulatedType(map.get("com.test.package.Ds3Type_v1"), "_v1");
    checkAutoPopulatedType(map.get("com.test.package.Ds3Type_v2"), "_v2");
}

From source file:com.cognifide.aet.runner.conversion.SuiteMergeStrategy.java

private static void mergeTest(Test currentTest, Test patternTest) {
    updateComment(currentTest, patternTest);
    currentTest.setComment(patternTest.getComment());
    final ImmutableMap<String, Url> urlsMap = FluentIterable.from(currentTest.getUrls())
            .uniqueIndex(URL_TO_MAP);

    for (Url patternUrl : patternTest.getUrls()) {
        if (urlsMap.containsKey(patternUrl.getName())) {
            mergeUrl(urlsMap.get(patternUrl.getName()), patternUrl);
        }/*from   ww  w.ja  va 2s  .c o  m*/
    }
}

From source file:com.facebook.buck.cxx.toolchain.CxxPlatformsProviderFactory.java

private static ImmutableMap<Flavor, UnresolvedCxxPlatform> appendHostPlatformIfNeeded(
        CxxPlatform defaultHostCxxPlatform, ImmutableMap<Flavor, UnresolvedCxxPlatform> cxxSystemPlatforms) {
    Flavor hostFlavor = CxxPlatforms.getHostFlavor();
    if (!cxxSystemPlatforms.containsKey(hostFlavor)) {
        return ImmutableMap.<Flavor, UnresolvedCxxPlatform>builder().putAll(cxxSystemPlatforms)
                .put(hostFlavor, new StaticUnresolvedCxxPlatform(
                        CxxPlatform.builder().from(defaultHostCxxPlatform).setFlavor(hostFlavor).build()))
                .build();/*from   w  w w. ja v  a  2 s.c o m*/
    } else {
        return cxxSystemPlatforms;
    }
}

From source file:org.apache.hadoop.yarn.nodelabels.NodeLabelTestBase.java

public static void assertMapEquals(Map<NodeId, Set<String>> expected,
        ImmutableMap<NodeId, Set<String>> actual) {
    Assert.assertEquals(expected.size(), actual.size());
    for (NodeId k : expected.keySet()) {
        Assert.assertTrue(actual.containsKey(k));
        assertCollectionEquals(expected.get(k), actual.get(k));
    }/*from ww w  . j a v  a 2 s. co m*/
}

From source file:org.apache.hadoop.yarn.nodelabels.NodeLabelTestBase.java

public static void assertLabelInfoMapEquals(Map<NodeId, Set<NodeLabel>> expected,
        ImmutableMap<NodeId, Set<NodeLabel>> actual) {
    Assert.assertEquals(expected.size(), actual.size());
    for (NodeId k : expected.keySet()) {
        Assert.assertTrue(actual.containsKey(k));
        assertNLCollectionEquals(expected.get(k), actual.get(k));
    }/*from ww  w.j av  a2s.c  o m*/
}

From source file:org.apache.hadoop.yarn.nodelabels.NodeLabelTestBase.java

public static void assertLabelsToNodesEquals(Map<String, Set<NodeId>> expected,
        ImmutableMap<String, Set<NodeId>> actual) {
    Assert.assertEquals(expected.size(), actual.size());
    for (String k : expected.keySet()) {
        Assert.assertTrue(actual.containsKey(k));
        Set<NodeId> expectedS1 = new HashSet<>(expected.get(k));
        Set<NodeId> actualS2 = new HashSet<>(actual.get(k));
        Assert.assertEquals(expectedS1, actualS2);
        Assert.assertTrue(expectedS1.containsAll(actualS2));
    }//  www .j  a va 2s.c o  m
}

From source file:org.apache.hadoop.yarn.nodelabels.NodeLabelTestBase.java

public static void assertLabelsInfoToNodesEquals(Map<NodeLabel, Set<NodeId>> expected,
        ImmutableMap<NodeLabel, Set<NodeId>> actual) {
    Assert.assertEquals(expected.size(), actual.size());
    for (NodeLabel k : expected.keySet()) {
        Assert.assertTrue(actual.containsKey(k));
        Set<NodeId> expectedS1 = new HashSet<>(expected.get(k));
        Set<NodeId> actualS2 = new HashSet<>(actual.get(k));
        Assert.assertEquals(expectedS1, actualS2);
        Assert.assertTrue(expectedS1.containsAll(actualS2));
    }//from  w w w .  j ava  2  s .  co  m
}