如何基於二維數組創建ArrayList<Object> points
datapoints
?將二維數組讀入arraylist中
Anothor問題:如果datapoints
是二維ArrayList,如何將第一列讀入lat
並將第二列讀入lon
?
public class Cluster {
private ArrayList<VisitPoint> points;
public Cluster(List[][] datapoints) {
Float lat;
Float lon;
for (int i=0; i<datapoints.length; i++) {
lat = datapoints[i][0];
lon = datapoints[i][1];
points.add(new VisitPoint(lat,lon));
}
}
public ArrayList<VisitPoint> getVisitPoints() {
return points;
}
}
問題是什麼? – 2013-03-25 17:38:11
什麼是List [] []數據點? @AchintyaJha我相信你可以告訴我。 – 2013-03-25 17:38:31
@LuiggiMendoza數據點是二維ArrayList ... !!!! – 2013-03-25 17:42:04