### Question:
SortedRangeList implements Iterable<Range> { @Override public Iterator<Range> iterator() { return getRanges(true); } SortedRangeList();  SortedRangeList(SortedRangeList list); void addRange(int min, int max); Iterator<Range> getRanges(); Iterator<Range> getRanges(boolean forward); int getMin(); int getMax(); int getNumRanges(); void removeRange(int min, int max); boolean contains(int value); boolean contains(int min, int max); int getRangeIndex(int value); Range getRange(int index); long getNumValues(); boolean intersects(int min, int max); boolean isEmpty(); void remove(SortedRangeList other); SortedRangeList intersect(SortedRangeList other); @Override String toString(); @Override Iterator<Range> iterator();  }### Answer:
@Test public void testIterator() { list.addRange(Integer.MIN_VALUE, Integer.MIN_VALUE+1); list.addRange(-1234,-1231); list.addRange(-13, -9); list.addRange(-8, -7); list.addRange(-1, 1); list.addRange(3,4); list.addRange(5,5); list.addRange(6,8); list.addRange(12,15); list.addRange(Integer.MAX_VALUE-3, Integer.MAX_VALUE); Iterator<Range> it = list.getRanges(); assertEquals(new Range(Integer.MIN_VALUE, Integer.MIN_VALUE+1), it.next()); assertEquals(new Range(-1234,-1231), it.next()); assertEquals(new Range(-13, -7), it.next()); assertEquals(new Range(-1, 1), it.next()); assertEquals(new Range(3,8), it.next()); assertEquals(new Range(12,15), it.next()); assertEquals(new Range(Integer.MAX_VALUE-3, Integer.MAX_VALUE), it.next()); it = list.getRanges(false); assertEquals(new Range(Integer.MAX_VALUE-3, Integer.MAX_VALUE), it.next()); assertEquals(new Range(12,15), it.next()); assertEquals(new Range(3,8), it.next()); assertEquals(new Range(-1, 1), it.next()); assertEquals(new Range(-13, -7), it.next()); assertEquals(new Range(-1234,-1231), it.next()); assertEquals(new Range(Integer.MIN_VALUE, Integer.MIN_VALUE+1), it.next()); }