@Test public void create3() { int[] indices = new int[] { 40, 20, 10, 41, 42, 43, 44, 15, 14, 13, 12, 11, 21, 22, 23, 25, 24 }; Interval[] intervals = Interval.createIntervals(indices); assertEquals("intervals.length", 3, intervals.length); }
public static Interval[] createIntervals(Collection<Integer> indices) { int[] array = new int[indices.size()]; int i = 0; for (Integer index : indices) { array[i++] = index; } return createIntervals(array); }
Interval { public static Interval[] createIntervals(Collection<Integer> indices) { int[] array = new int[indices.size()]; int i = 0; for (Integer index : indices) { array[i++] = index; } return createIntervals(array); } }
Interval { public static Interval[] createIntervals(Collection<Integer> indices) { int[] array = new int[indices.size()]; int i = 0; for (Integer index : indices) { array[i++] = index; } return createIntervals(array); } Interval(final int startIndex, final int endIndex); }
Interval { public static Interval[] createIntervals(Collection<Integer> indices) { int[] array = new int[indices.size()]; int i = 0; for (Integer index : indices) { array[i++] = index; } return createIntervals(array); } Interval(final int startIndex, final int endIndex); boolean intersects(Interval other); boolean intersects(Collection<Interval> col); static Interval[] createIntervals(Collection<Integer> indices); static Interval[] createIntervals(int[] indices); String toString(); }
Interval { public static Interval[] createIntervals(Collection<Integer> indices) { int[] array = new int[indices.size()]; int i = 0; for (Integer index : indices) { array[i++] = index; } return createIntervals(array); } Interval(final int startIndex, final int endIndex); boolean intersects(Interval other); boolean intersects(Collection<Interval> col); static Interval[] createIntervals(Collection<Integer> indices); static Interval[] createIntervals(int[] indices); String toString(); final int startIndex; final int endIndex; }