code: private static boolean atLeastTwoPoints(GeometryCollection points,
                                              int initialNumberOfPoints) throws SQLException {
          int numberOfPoints = initialNumberOfPoints;
          for (int i = 0; i < points.getNumGeometries(); i++) {
              Geometry p = points.getGeometryN(i);
              if (numberOfPoints >= REQUIRED_NUMBER_OF_POINTS) {
                  return true;
              }
              numberOfPoints = numberOfPoints + countPoints(p);
          }
          return numberOfPoints >= REQUIRED_NUMBER_OF_POINTS;
      }
docs: Returns true as soon as we know the collection contains at least two
  points. Start counting from the initial number of points.
  
  @param points                Collection of points
  @param initialNumberOfPoints The initial number of points
  @return True as soon as we know the collection contains at least two
  points.