Range implements Iterable<Integer> { public static Range create(int start, int end) { return new Range(start, end, 1); } private  Range(int start, int end, int step); static Range createWithCount(int start, int count); static Range create(int start, int end); static Range createWithStep(int start, int end, int step); @Override Iterator<Integer> iterator(); @Override String toString();  }
@Test public void testSimpleRange() { assertEquals(Arrays.asList(1, 2, 3, 4), toList(Range.create(1, 5))); }