0

How do I set the default value (returned when the key doesn't exist) for a TLongDoubleHashMap collection. It returns 0 by default, I would like it to return NaN.

I found this in the documentation:

Returns the value that will be returned from get(long) or put(long, double) if no entry exists for a given key. The default value is generally zero, but can be changed during construction of the collection.

But I have found no way to set the value during construction.

Sotirios Delimanolis
  • 274,122
  • 60
  • 696
  • 724
Savage Reader
  • 387
  • 1
  • 4
  • 16

1 Answers1

2

By using this constructor:

public TLongDoubleHashMap(int initialCapacity,float loadFactor,long noEntryKey,double noEntryValue)

For example:

TLongDoubleHashMap map = new TLongDoubleHashMap(5, 0.5f, Double.NaN, Double.NaN)
Xavier Delamotte
  • 3,519
  • 19
  • 30