tarvid wrote: dataset.addValue(x,1,1);
This seems to be related to autoboxing/unboxing, and my guess is that it is either a bug or a "quirk" in the way autoboxing/unboxing works (but I'm not sure, because most of the time I'm still a Java 1.3 programmer so I haven't really studied this "new" feature).
If you change the above line to:
- Code: Select all
dataset.addValue(x, "1", "1");
...the compile problem goes away. For whatever reason, the auto-conversion of the two int primitives into Integer objects (required to match the method signature which requires instances of Comparable for the column and row keys) somehow results in the compiler now being unable to handle the fact that 'x' can be either a double or a Number. But if you supply Strings for the keys, now the compiler doesn't mind that it could either convert the 'x' to a Double (Number) or leave it as a double primitive. Strange.