### Question:
Range { public <T> List<T> apply(T[] a) { return apply(Arrays.asList(a)); } Range(int min, int max); List<T> apply(T[] a); List<T> apply(List<T> s); Iterable<T> apply(final Collection<T> s); Iterable<T> apply(final Iterable<T> s); final int min; final int max; static final Range ALL; }### Answer:
@Test public void normalRange() { Range r = new Range(2,4); assertEquals("[c, d]", toS(r.apply(array))); assertEquals("[c, d]", toS(r.apply(list))); assertEquals("[c, d]", toS(r.apply(set))); }
@Test public void maxOnlyRange() { Range r = new Range(-1,2); assertEquals("[a, b]", toS(r.apply(array))); assertEquals("[a, b]", toS(r.apply(list))); assertEquals("[a, b]", toS(r.apply(set))); }
@Test public void minOnlyRange() { Range r = new Range(4,Integer.MAX_VALUE); assertEquals("[e, f]", toS(r.apply(array))); assertEquals("[e, f]", toS(r.apply(list))); assertEquals("[e, f]", toS(r.apply(set))); }