code: static Shape shapeOf(List<Point2D> points) {
          Path2D path = new Path2D.Double();
          if (!points.isEmpty()) {
              path.moveTo(points.get(0).getX(), points.get(0).getY());
              for (Point2D point : points)
                  path.lineTo(point.getX(), point.getY());
              path.closePath();
          }
          return path;
      }
docs: Convert a list of points to a shape.
  
  @param points list of points
  @return a shape