diff options
Diffstat (limited to 'uitest/src/com/vaadin/tests/util/RangeCollection.java')
-rw-r--r-- | uitest/src/com/vaadin/tests/util/RangeCollection.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/util/RangeCollection.java b/uitest/src/com/vaadin/tests/util/RangeCollection.java new file mode 100644 index 0000000000..f26e3cfb15 --- /dev/null +++ b/uitest/src/com/vaadin/tests/util/RangeCollection.java @@ -0,0 +1,48 @@ +package com.vaadin.tests.util; + +import java.util.AbstractCollection; +import java.util.Iterator; + +public class RangeCollection extends AbstractCollection<Integer> { + + public static class RangeIterator implements Iterator<Integer> { + + 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<Integer> iterator() { + return new RangeIterator(size - 1); + } + + @Override + public int size() { + return size; + } + +}
\ No newline at end of file |