我必須將此輸入從文件分解爲矢量並添加到矢量中。將輸入分解爲矢量
文件輸入
1,375,seller
1,375,sellers
1,375,send
1,375,sister
1,375,south
1,375,specific
1,375,spoiler
1,375,stamp
1,375,state
1,375,stop
1,375,talked
1,375,tenant
1,375,today
1,375,told
FileInputStream fstream = new FileInputStream("e://inputfile.txt");
// Use DataInputStream to read binary NOT text.
BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
String strLine;
while ((strLine = br.readLine()) != null)
{
Vector dataPoints = new Vector();
dataPoints.add(br);
dataPoints.add(new DataPoint());
}
------ public DataPoint(double x, double y, String name) this is the method
如何將字符串分割成雙人牀和串並給予輸入向量?
閱讀上['String.split'](http://docs.oracle.com/javase/6/docs/api/java/lang/String .html#split(java.lang.String))和['Double.valueOf'](http://docs.oracle.com/javase/6/docs/api/java/lang/Double.html#valueOf(java .lang.String))。 – Perception 2013-02-13 16:10:28
爲什麼要使用'Vector'而不是'ArrayList'? – jlordo 2013-02-13 16:10:38