Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I Did It Your Way, 11.95
- The History of Scotland, 14.50
- Learn Calculus in One Day, 29.95
- Feel the Stress, 18.50
- Great Poems, 12.95
- Europe on a Shoestring, 10.95
- The Life of Mozart, 14.50
- BufferedReader r = new BufferedReader(new FileReader("file.txt"));
- List<String> titles = new ArrayList<String>();
- List<Double> prices = new ArrayList<Double>();
- while ((String line = r.readLine()) != null) {
- String[] tokens = line.split(",");
- titles.add(tokens[0].trim());
- prices.add(Double.parseDouble(tokens[1].trim()));
- }
- r.close();
- CSVReader reader = new CSVReader(new FileReader("test.txt"));
- List myEntries = reader.readAll();
- int noOfEntries=myEntries.size();
- String[] titles=new String[noOfEntries];
- String[] price=new String[noOfEntries];
- String[] entry=null;
- int i=0;
- for(Object entryObject:myEntries){
- entry=(String[]) entryObject;
- titles[i]=entry[0];
- price[i]=entry[1];
- i++;
- }
Add Comment
Please, Sign In to add comment