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;
}
在执行到?号的地方就抛出异常请问怎么回事及解决办法,多谢
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;
}
在执行到?号的地方就抛出异常请问怎么回事及解决办法,多谢
...全文
相关推荐
JAVA中list,set,数组之间的转换详解
从Collection转换为数组,可以调用`Collection.toArray()`方法。
本java压缩程序可通过编译,但执行时却抛出异常,请高手指点!
本java压缩程序可通过编译,但执行时却抛出异常,请高手指点!
Array和Collection相互转换以及copy深度的小测
**从Array转换到Collection**1. **Arrays.asList()**: 这是将数组转换为`List`的最简单方式。
请高手指点图片居中的问题
请高手指点一下,想把图片水平垂直居中放置,网上找了一些教程,但是没有作用,请帮忙指出哪里出了问题本主题由 Rolan 于前天09:44审核通过1.jpg(50.38 KB, 下载次数: 2)
js将类数组对象转换成数组对象
因此,在开发中我们经常会需要将类数组对象转换成真正的数组对象,以便能够使用数组的各种方法。在标准浏览器中,可以使用Array.prototype.slice.call()方法将类数组对象转换为数组。


Web 开发
