collection 转换为数组请高手们指点,在线等!

cuilupeng999 cuilupeng999 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
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;
}
在执行到?号的地方就抛出异常请问怎么回事及解决办法,多谢
...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
cuilupeng999
Web 开发 81,108 成员 341,721 内容