What does the following return do? And how can I use that value:
private Map<Double, String> theLabels = new HashMap<Double, String>();
public Double[] getTheLabels() {
return theLabels.keySet().toArray(new Double[0]);
}
Is this correct?
Double[] aD = theClassInQuestion.getTheLabels();
Thanks in advance.
HJW
It is correct, however, unless the theLabels is empty, the reallocation of the array is forced. Here is an alternative:
public Double[] getTheLabels() {
return theLabels.keySet().toArray(new Double[theLabels.size()]);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With