This week's book giveaway is in the Big Data forum. We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line! See this thread for details.

I was wondering if any of you might have come across something like this before.

I'm trying to add key value pairs into a SortedMap, where the key is a Double. The key is usually a number like 0.01042 which has 6 digit precision. SortedMap newMap = new TreeMap(); newMap.put(key, value);

The problem is that when I try to do something like Object key = newMap.getFirstKey(); Double keyDouble = Double.getValue(key); double timeStamp1 = firstKey.doubleValue();

the timeStamp1 value when printed out is only 1 decimal place precision (0.0).

Can anyone suggest anything please ? Thanks in advance for any suggestions.

Double has no getValue() method, so it's hard for us to see exactly what you're doing here. If you can cut and paste the relevant bit of real code that'd be great.

thank you both for replying. Sorry about the line saying "Double keyDouble = Double.getValue(key);" - that was me getting muddled with something.

What I'm trying to do is: Double firstKey = (Double)firstRow.firstKey(); double timeStamp1 = firstKey.doubleValue(); Double secondKey = (Double)secondRow.firstKey(); double timeStamp2 = secondKey.doubleValue(); double interval = timeStamp1 - timeStamp2;

where firstRow and secondRow are 2 separate TreeMaps. Each TreeMap contains a timestamp (key) and a number(value). I want to subtract the timestamps to see if there is a particular interval between them. The problem is that the timestamps should be something like 376222.010420 and 37622.020837 (0.010420 apart).

Thanks again, any suggestions gratefully received.