Originally posted by CM Ananth:
I feel there won't be any use case for adding NULL as a key and store a value for it. I wonder why such a feature is allowed by java and some real world examples will help me to understand the use of this feature.
Brian Carlisle wrote:Hello - i was running some basic code tests to try and do this and keep getting a runtime exception whenever i add another element to the Map/Set after putting a null key initially. Seems that it always fails on the equals method when comparing the current object being inserted to the previous null entry. This makes sense so i am curious how this is implemented in the real world. A bit confused..
Brian Carlisle wrote:
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton