CoordinateSequence2D implements CoordinateSequence, Cloneable { public Coordinate[] toCoordinateArray() { Coordinate[] coords = new Coordinate[x.length]; for (int i = 0; i < x.length; i++) { coords[i] = new Coordinate(x[i], y[i]); } return coords; } 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 testToCoordinateArray() { CoordinateSequence2D cs = new CoordinateSequence2D(1.1, 1.2, 2.1, 2.2, 3.1, 3.2); Coordinate[] coords = cs.toCoordinateArray(); assertEquals(3, coords.length); for (int i = 0; i < coords.length; i++) { double x = i + 1.1; double y = i + 1.2; assertEquals(x, coords[i].x, TOL); assertEquals(y, coords[i].y, TOL); } }