src/main/java/de/javagl/geom/Paths.java
/**
     * Creates a new path that consists of line segments between the
     * given points
     * 
     * @param points The points
     * @param close Whether the path should be closed
     * @return The path
     */
Creates a new path that consists of line segments between the
given points

@param points The points
@param close Whether the path should be closed
@return The path
Creates a new path that consists of line segments between the given points @param points The points @param close Whether the path should be closed @return The path
public static Path2D fromPoints(
        Iterable<? extends Point2D> points, boolean close)
    {
        Path2D path = new Path2D.Double();
        Iterator<? extends Point2D> iterator = points.iterator();
        boolean hasPoints = false;
        if (iterator.hasNext())
        {
            Point2D point = iterator.next();
            path.moveTo(point.getX(), point.getY());
            hasPoints = true;
        }
        while (iterator.hasNext())
        {
            Point2D point = iterator.next();
            path.lineTo(point.getX(), point.getY());
        }
        if (close && hasPoints)
        {
            path.closePath();
        }
        return path;
    }
public static Path2D fromPoints ( Iterable < ? extends Point2D > points , boolean close ) { Path2D path = new Path2D . Double ( ) ; Iterator < ? extends Point2D > iterator = points . iterator ( ) ; boolean hasPoints = false ; if ( iterator . hasNext ( ) ) { Point2D point = iterator . next ( ) ; path . moveTo ( point . getX ( ) , point . getY ( ) ) ; hasPoints = true ; } while ( iterator . hasNext ( ) ) { Point2D point = iterator . next ( ) ; path . lineTo ( point . getX ( ) , point . getY ( ) ) ; } if ( close && hasPoints ) { path . closePath ( ) ; } return path ; }
Creates a new path that consists of line segments between the
 given points
Creates a new path that consists of line segments between the given points