CoordinateSequence2D implements CoordinateSequence, Cloneable { @Override public Object clone() { CoordinateSequence2D copy = new CoordinateSequence2D(x.length); for (int i = 0; i < x.length; i++) { copy.x[i] = x[i]; copy.y[i] = y[i]; } return copy; } CoordinateSequence2D(int n);  CoordinateSequence2D(double... xy); int getDimension(); Coordinate getCoordinate(int index); Coordinate getCoordinateCopy(int index); void getCoordinate(int index, Coordinate coord); double getX(int index); double getY(int index); double getOrdinate(int index, int ordinateIndex); int size(); void setOrdinate(int index, int ordinateIndex, double value); void setX(int index, double value); void setY(int index, double value); void setXY(int index, double x, double y); Coordinate[] toCoordinateArray(); Envelope expandEnvelope(Envelope env); @Override Object clone(); CoordinateSequence copy();  }
@Test public void testClone() { CoordinateSequence2D cs = new CoordinateSequence2D(1,2,3,4,5,6); CoordinateSequence2D copy = (CoordinateSequence2D) cs.clone(); assertTrue(cs != copy); assertEquals(cs.size(), copy.size()); for (int i = 0; i < cs.size(); i++) { assertEquals(cs.getX(i), copy.getX(i), TOL); assertEquals(cs.getY(i), copy.getY(i), TOL); } }