Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #584 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

HashMap finds integer "0" as an invalid key.

Reported by: Nietsnie Assigned to: sean
Priority: normal Milestone: 0.99.1 RC4
Component: Core Functionality Version: 0.99 RC3 Xammy
Keywords: Cc:

Description

HashMap?.add calls checkKey, which is in MapCollection?.

MapCollection? uses allowKey (in the checkKey function) which checks to see if the value passed is equal to the init value. If so, it throws an exception.

I think that function should instead use a similar function called isValidKey which instead checks if it's a null value if it's an object.

ie:

 	        protected final void checkKey(K key)
 	        {
 	                if (!isValidKey(key))
 	                   {
 	                   throw new IllegalElementException("Attempt to include invalid key _in Collection");
 	                   }
 	        }

In fact, it looks like this allowKey function has been deprecated by the isValidKey function.

Attachments

MapCollection-checkKey.patch (427 bytes) - added by Nietsnie on 08/20/07 22:30:24.

Change History

08/20/07 22:30:24 changed by Nietsnie

  • attachment MapCollection-checkKey.patch added.

08/20/07 22:31:09 changed by Nietsnie

I've attached a patch for MapCollection? that resolves the issue.

08/26/07 16:22:01 changed by kris

  • status changed from new to closed.
  • resolution set to fixed.
  • milestone set to 0.99.1 RC4.

Thx!

fixed in [2507]