Range implements Iterable<Integer> { public static Range createWithStep(int start, int end, int step) { return new Range(start, end, step); } 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 testRangeWithStep() { assertEquals(Arrays.asList(1, 3, 5, 7, 9), toList(Range.createWithStep(1, 10, 2))); }