@Test(expected = UnsupportedOperationException.class) public void shouldThrowUnsupportedOperationExceptionIfTryingToRemoveFromTheReturnedIterator() throws Exception { Range<Integer> range = new IntegerRange(0, 10); Iterator<Integer> iterator = range.iterator(); iterator.next(); iterator.remove(); }
@Override public Iterator<Integer> iterator() { if (start < end && step < 0 || start > end && step > 0) { return Iterators.emptyIterator(); } return new IntegerRangeIterator(); }
IntegerRange implements Range<Integer> { @Override public Iterator<Integer> iterator() { if (start < end && step < 0 || start > end && step > 0) { return Iterators.emptyIterator(); } return new IntegerRangeIterator(); } }
IntegerRange implements Range<Integer> { @Override public Iterator<Integer> iterator() { if (start < end && step < 0 || start > end && step > 0) { return Iterators.emptyIterator(); } return new IntegerRangeIterator(); } IntegerRange(Integer start, Integer end);  IntegerRange(Integer start, Integer end, Integer step); }
IntegerRange implements Range<Integer> { @Override public Iterator<Integer> iterator() { if (start < end && step < 0 || start > end && step > 0) { return Iterators.emptyIterator(); } return new IntegerRangeIterator(); } IntegerRange(Integer start, Integer end);  IntegerRange(Integer start, Integer end, Integer step); @Override boolean contains(Object other); @Override Integer getStart(); @Override Integer getEnd(); @Override Integer getStep(); @Override Iterator<Integer> iterator(); }
IntegerRange implements Range<Integer> { @Override public Iterator<Integer> iterator() { if (start < end && step < 0 || start > end && step > 0) { return Iterators.emptyIterator(); } return new IntegerRangeIterator(); } IntegerRange(Integer start, Integer end);  IntegerRange(Integer start, Integer end, Integer step); @Override boolean contains(Object other); @Override Integer getStart(); @Override Integer getEnd(); @Override Integer getStep(); @Override Iterator<Integer> iterator();  }