class DataSeries implements Iterable<DataSeries.Point> {

    @NonNull
    public Iterator<Point> iterator() {
        return new Iterator<Point>() {
            private int i = 0;

            public boolean hasNext() {
                return i < n;
            }

            public Point next() {
                if (i < n)
                    return points.get(i++);
                else
                    throw new NoSuchElementException();
            }

            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }

}