public virtual ICollection <K3> ThirdKeySet()
        {
            ICollection <K3> keys = Generics.NewHashSet();

            foreach (K1 k1 in map.Keys)
            {
                TwoDimensionalMap <K2, K3, V> m = map[k1];
                foreach (K2 k2 in m.FirstKeySet())
                {
                    Sharpen.Collections.AddAll(keys, m.Get(k2).Keys);
                }
            }
            return(keys);
        }
        public virtual ICollection <K4> FourthKeySet()
        {
            ICollection <K4> keys = Generics.NewHashSet();

            foreach (K1 k1 in map.Keys)
            {
                ThreeDimensionalMap <K2, K3, K4, V> m3 = map[k1];
                foreach (K2 k2 in m3.FirstKeySet())
                {
                    TwoDimensionalMap <K3, K4, V> m2 = m3.Get(k2);
                    foreach (K3 k3 in m2.FirstKeySet())
                    {
                        Sharpen.Collections.AddAll(keys, m2.Get(k3).Keys);
                    }
                }
            }
            return(keys);
        }
        public virtual void TestBasicOperations()
        {
            TwoDimensionalMap <string, string, string> map = new TwoDimensionalMap <string, string, string>();

            NUnit.Framework.Assert.AreEqual(0, map.Size());
            NUnit.Framework.Assert.IsTrue(map.IsEmpty());
            map.Put("A", "B", "C");
            NUnit.Framework.Assert.AreEqual("C", map.Get("A", "B"));
            NUnit.Framework.Assert.AreEqual(1, map.Size());
            NUnit.Framework.Assert.IsFalse(map.IsEmpty());
            NUnit.Framework.Assert.IsTrue(map.Contains("A", "B"));
            NUnit.Framework.Assert.IsFalse(map.Contains("A", "C"));
            NUnit.Framework.Assert.IsFalse(map.Contains("B", "F"));
            map.Put("A", "B", "D");
            NUnit.Framework.Assert.AreEqual("D", map.Get("A", "B"));
            NUnit.Framework.Assert.AreEqual(1, map.Size());
            NUnit.Framework.Assert.IsFalse(map.IsEmpty());
            NUnit.Framework.Assert.IsTrue(map.Contains("A", "B"));
            NUnit.Framework.Assert.IsFalse(map.Contains("A", "C"));
            NUnit.Framework.Assert.IsFalse(map.Contains("B", "F"));
            map.Put("A", "C", "E");
            NUnit.Framework.Assert.AreEqual("D", map.Get("A", "B"));
            NUnit.Framework.Assert.AreEqual("E", map.Get("A", "C"));
            NUnit.Framework.Assert.AreEqual(2, map.Size());
            NUnit.Framework.Assert.IsFalse(map.IsEmpty());
            NUnit.Framework.Assert.IsTrue(map.Contains("A", "B"));
            NUnit.Framework.Assert.IsTrue(map.Contains("A", "C"));
            NUnit.Framework.Assert.IsFalse(map.Contains("B", "F"));
            map.Put("B", "F", "G");
            NUnit.Framework.Assert.AreEqual("D", map.Get("A", "B"));
            NUnit.Framework.Assert.AreEqual("E", map.Get("A", "C"));
            NUnit.Framework.Assert.AreEqual("G", map.Get("B", "F"));
            NUnit.Framework.Assert.AreEqual(3, map.Size());
            NUnit.Framework.Assert.IsFalse(map.IsEmpty());
            NUnit.Framework.Assert.IsTrue(map.Contains("A", "B"));
            NUnit.Framework.Assert.IsTrue(map.Contains("A", "C"));
            NUnit.Framework.Assert.IsTrue(map.Contains("B", "F"));
            map.Clear();
            NUnit.Framework.Assert.AreEqual(0, map.Size());
            NUnit.Framework.Assert.IsTrue(map.IsEmpty());
        }
        public virtual void TestAddAll()
        {
            TwoDimensionalMap <string, string, string> m1 = TwoDimensionalMap.HashMap();

            m1.Put("A", "B", "1");
            m1.Put("Z", "Y", "2");
            m1.Put("Z", "B", "3");
            m1.Put("A", "Y", "4");
            m1.Put("D", "D", "5");
            m1.Put("D", "F", "6");
            m1.Put("K", "G", "7");
            m1.Put("G", "F", "8");
            TwoDimensionalMap <string, string, string> m2 = TwoDimensionalMap.TreeMap();

            m2.AddAll(m1, Functions.IdentityFunction <string>());
            NUnit.Framework.Assert.AreEqual(m1, m2);
            IFunction <string, int> valueOf            = null;
            TwoDimensionalMap <string, string, int> m3 = TwoDimensionalMap.HashMap();

            m3.AddAll(m1, valueOf);
            NUnit.Framework.Assert.AreEqual(m1.Size(), m3.Size());
            NUnit.Framework.Assert.AreEqual(3, m3.Get("Z", "B"));
        }