EMPTY_VALUE should be settable for Map
When using classes such as ObjectDoubleHashMap we should be able to set the EMPTY_VALUE upon construction. In our situation, Zero is a perfectly valid double value and does not properly differentiate between a valid or invalid key without explictly checking containsKey. Which is expensive!
We would like to be able to set this to NaN which was supported by Trove collections.
It looks like this would be exceptionally simple to impliment... This is a make or break for us.
Thank you!
You're expected to use the getIfAbsent method in your case. E.g. getIfAbsent(someKey, Double.NaN). We'd prefer not to add 8 bytes to every map when a lighter solution exists.
Also, if you are so performance sensitive that contains() is too much of an overhead, you might be interested in several other methods in the API that make working with *DoubleMap's faster and more productive. Some of my favorites:
public double addToValue(K key, double toBeAdded)
public double updateValue(K key, double initialValueIfAbsent, DoubleToDoubleFunction function)
public <P> double getIfAbsentPutWith(K key, DoubleFunction<? super P> function, P parameter)
Oh thats perfect!! I overlooked it because I saw it was "Static" and was more familiar with Trove that supplied it as part of construction. Thank you!