Пример #1
0
        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"));
        }