Ejemplo n.º 1
0
        public void testValues()
        {
            FastMap <String, String> map      = buildTestFastMap();
            IEnumerable <String>     expected = Sets.newHashSetWithExpectedSize(3);

            expected.add("bar");
            expected.add("bang");
            expected.add("beta");
            IEnumerable <String> actual = map.values();

            Assert.True(expected.containsAll(actual));
            Assert.True(actual.containsAll(expected));
            IEnumerable <String> it = actual.iterator();

            while (it.hasNext())
            {
                String value = it.next();
                if (!"bang".Equals(value))
                {
                    it.remove();
                }
            }
            Assert.True(map.containsValue("bang"));
            Assert.False(map.containsValue("bar"));
            Assert.False(map.containsValue("beta"));
        }
Ejemplo n.º 2
0
        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"));
        }