code: protected Coordinate[] toCoordinateArray(Stack stack) {
          Coordinate[] coordinates = new Coordinate[stack.size()];
          for (int i = 0; i < stack.size(); i++) {
              Coordinate coordinate = (Coordinate) stack.get(i);
              coordinates[i] = coordinate;
          }
          return coordinates;
      }
docs: An alternative to Stack.toArray, which is not present in earlier versions
  of Java.
  @param stack