package com.vaadin.tests.util; import java.util.AbstractCollection; import java.util.Iterator; public class RangeCollection extends AbstractCollection { public static class RangeIterator implements Iterator { private int value; private int max; public RangeIterator(int max) { this.max = max; value = 0; } public boolean hasNext() { return (value < max - 1); } public Integer next() { return value++; } public void remove() { throw new UnsupportedOperationException(); } } private int size = 0; public RangeCollection(int size) { this.size = size; } @Override public Iterator iterator() { return new RangeIterator(size - 1); } @Override public int size() { return size; } }