Beispiel #1
0
        public void TestValues()
        {
            Collection <Object> c = hm.Values();

            Assert.IsTrue(c.Size() == hm.Size(), "Returned collection of incorrect Size()");
            for (int i = 0; i < objArray.Length; i++)
            {
                Assert.IsTrue(c.Contains(objArray[i]), "Returned collection does not contain all keys");
            }

            HashMap <Object, Object> myHashMap = new HashMap <Object, Object>();

            for (int i = 0; i < 100; i++)
            {
                myHashMap.Put(objArray2[i], objArray[i]);
            }

            Collection <Object> values = myHashMap.Values();

//            new Support_UnmodifiableCollectionTest(
//                 "Test Returned Collection From HashMap.Values()", values)
//                 .runTest();
            values.Remove(0);
            Assert.IsTrue(!myHashMap.ContainsValue(0),
                          "Removing from the values collection should Remove from the original map");
        }
Beispiel #2
0
 public override bool Contains(V val)
 {
     return(parent.ContainsValue(val));
 }