collection 转换为数组请高手们指点,在线等!
public class DisplaySet {
private String key;
private String value;
public DisplaySet() {
}
public void setKey(String key){
this.key = key;
}
public String getKey(){
return this.key;
}
public void setValue(String value){
this.value = value;
}
public String getValue(){
return this.value;
}
}
//////////////////////
public double[][] converseCToA(Collection cl) {
int sum = cl.size();
Iterator it = cl.iterator();
double[][] XYData = {};
int i = 0;
try{
while (it.hasNext() && i < sum) {
DisplaySet keys = (DisplaySet) it.next();
System.out.println(Double.valueOf(keys.getKey()).doubleValue());
XYData[0][0] = Integer.parseInt(keys.getKey());//?
XYData[1][0] = Integer.parseInt(keys.getValue());
i++;
}
}catch(Exception e){
System.err.println(e.getMessage());
}
return XYData;
}
在执行到?号的地方就抛出异常请问怎么回事及解决办法,多谢