示例#1
0
        public static void run()
        {
            #region Hash Table Test
            Console.WriteLine("\n----------------Hash Table Test-----------------");
            Console.WriteLine("-------Hash Table Array Test:");
            HashTableArray <string> tableArray = new HashTableArray <string>(3);
            tableArray.Add(312, "abcbca");
            tableArray.Add(123, "qwer");
            tableArray.Add(2, "qw");
            tableArray.View();

            Console.WriteLine("\nHash-table after removing by key 123:");
            tableArray.Remove(123);
            tableArray.View();

            Console.WriteLine("\n------Hash Table List Test:");
            HashTableList <string> tableList = new HashTableList <string>(5);
            tableList.Add(1, "abc");
            tableList.Add(6, "abc");
            tableList.Add(11, "abc");
            tableList.Add(16, "a");
            tableList.Add(0, "bc");
            tableList.View();

            Console.WriteLine("\nHash-table after removing by key 11 & 0:");
            tableList.Remove(11);
            tableList.Remove(0);
            tableList.View();
            #endregion
        }
示例#2
0
        public void RemoveTest()
        {
            HashTableArray repository = new HashTableArray(1, new HashFuctionExample());

            repository.Add("1", "item 1");
            repository.Remove("1");
            Assert.IsNull(repository.Find("1"));
        }