示例#1
0
            // evaluate for equality of value
            public override bool Equals(object obj)
            {
                if (obj == null)
                {
                    return(false);
                }

                HashMapNode node = obj as HashMapNode;

                if (node == null)
                {
                    return(false);
                }

                return(node.Key == this.Key && node.Value == this.Value);
            }
示例#2
0
        public void Add(TKey key, TVal val)
        {

            HashMapNode<TKey, TVal> node = new HashMapNode<TKey, TVal>(key, val);
            int hashCode = Math.Abs(key.GetHashCode());
            int index = GetIndex(hashCode);


            if (HashMapNode[index] != null)
            {
                HashMapNode<TKey, TVal> hashTemp = HashMapNode[index];

                do
                {
                    if (hashTemp.hashCode == hashCode)
                    {
                        Console.WriteLine("Key is already exists");
                        return;
                    }
                    else