Advertisement
Guest User

Untitled

a guest
May 20th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. private static ArrayList<Point> getInputPoints(String path) {
  2.         try (BufferedReader br = new BufferedReader(new FileReader(new File(path)))) {
  3.             ArrayList<Point> points = new ArrayList<>();
  4.             String line;
  5.             while ((line = br.readLine()) != null) {
  6.                 // process the line.
  7.                 String[] data = line.split(",");
  8.                 double x = Double.parseDouble(data[0].trim());
  9.                 double y = Double.parseDouble(data[1].trim());
  10.                 int color = Integer.parseInt(data[2].trim());
  11.                 points.add(new Point(x, y, color));
  12.             }
  13.             return points;
  14.         } catch(Exception e) {
  15.             return null;
  16.         }
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement