public void testKeySet() { FastMap <String, String> map = buildTestFastMap(); IEnumerable <String> expected = Sets.newHashSetWithExpectedSize(3); expected.add("foo"); expected.add("baz"); expected.add("alpha"); Set <String> actual = map.keySet(); Assert.True(expected.containsAll(actual)); Assert.True(actual.containsAll(expected)); IEnumerable <String> it = actual.iterator(); while (it.hasNext()) { String value = it.next(); if (!"baz".Equals(value)) { it.remove(); } } Assert.True(map.containsKey("baz")); Assert.False(map.containsKey("foo")); Assert.False(map.containsKey("alpha")); }
public void testContains() { FastMap <String, String> map = buildTestFastMap(); Assert.True(map.containsKey("foo")); Assert.True(map.containsKey("baz")); Assert.True(map.containsKey("alpha")); Assert.True(map.containsValue("bar")); Assert.True(map.containsValue("bang")); Assert.True(map.containsValue("beta")); Assert.False(map.containsKey("something")); Assert.False(map.containsValue("something")); }