public NativeArray getEndPoints() {
Context cx = getCurrentContext();
NativeArray components = getComponents();
int size = components.size();
Scriptable scope = getParentScope();
NativeArray array = (NativeArray) cx.newArray(scope, 2*size);
for (int i=0; i<size; ++i) {
com.vividsolutions.jts.geom.LineString geom = (com.vividsolutions.jts.geom.LineString) components.get(i);
LineString line = (LineString) GeometryWrapper.wrap(scope, geom);
array.put(2*i, array, line.getStartPoint());
array.put((2*i)+1, array, line.getEndPoint());