I'm kind of a newbie still in java, can you tell me whats the difference between these two constructors?
First:
public class Plan { ArrayList<Point2D> points; public Plan(ArrayList<Ponto2D> points) { this.points = new Arraylist<Point2D>(points); } } and this : second:
public class Plan { public Plan(ArrayList<Point2D> lpoints) { points = new ArrayList<Point2D>(); for(Point2D p : lpoints) point.add(p.clone()); } }
pointsArrayList, the second constructor takes a ArrayList, iterates through it, and adds topointsafter initializingpoints.Point2D.clone()in the second example.shallow copyis