oshdb icon indicating copy to clipboard operation
oshdb copied to clipboard

MapAggregator.sum / NumberUtils.add don't support Long as Numeric type

Open rtroilo opened this issue 4 years ago • 0 comments

Using MapAggregator.sum(x -> 1L) will result in a ClassCastException:

Exception in thread "main" java.lang.ClassCastException: class java.lang.Double cannot be cast to class java.lang.Long (java.lang.Double and java.lang.Long are in module java.base of loader 'bootstrap')
	at java.base/java.util.TreeMap.forEach(TreeMap.java:1002)

Reason is that NumericUtils.add defaults to type Double if input type is not (integer / float).

rtroilo avatar Aug 06 '21 16:08 rtroilo