### Question:
Range implements Iterable<E> { @Override public Iterator<E> iterator() { return new Iterator<E>() { E current = null; E next = getFirst(); @Override public boolean hasNext() { return next != null; } @Override public E next() { current = next; next = (getLast().equals(next)) ? null : next(next); return current; } @Override public void remove() { if (current == null) throw new IllegalStateException(); boolean atFirst = current.equals(getFirst()); boolean atLast = current.equals(getLast()); if (atFirst && !atLast) { Range.this.remove(current); current = null; next = Range.this.getFirst(); } else if (atLast && !atFirst) { Range.this.remove(current); current = null; next = null; } else throw new UnsupportedOperationException("Iterator can only remove elements from the ends of a Range."); } @SuppressWarnings("unchecked") private E next(E e) { return enumerator==null ? ((IEnumerable<E>)e).getNext() : enumerator.getNext(e); } }; } Range(E element);  Range(E first, E last);  Range(E first, E last, IEnumerator<E> enumerator);  Range(Range<E> other); E getFirst(); E getLast(); boolean contains(E element); boolean contains(Range<E> range); boolean containedBy(E first, E last); boolean overlaps(Range<E> range); boolean overlaps(E first, E last); boolean canAdd(Range<E> range); void add(Range<E> range); void merge(Range<E> range); Range<E> remove(E element); Range<E> remove(Range<E> range); Range<E> remove(E first, E last); boolean equals(Object object); int hashCode(); String toString(); @Override Iterator<E> iterator();  }### Answer:
@Test public void testIterator() { Range<Integer> range = range(-3,3); List<Integer> values = new ArrayList<Integer>(); for (Integer i : range) values.add(i); assertEquals(Arrays.asList(new Integer[] {-3, -2, -1, 0, 1, 2, 3}), values); }