### Question:
Extents { public static <T extends Comparable<? super T>> Extent<T> findMinMax(Collection<T> coll) { Iterator<? extends T> i = coll.iterator(); T minCandidate = i.next(); T maxCandidate = minCandidate; while (i.hasNext()) { T next = i.next(); if (next != null && !next.equals(Float.NaN) && !next.equals(Double.NaN)) { if (minCandidate == null || next.compareTo(minCandidate) < 0) { minCandidate = next; } if (maxCandidate == null || next.compareTo(maxCandidate) > 0 || maxCandidate.equals(Float.NaN) || maxCandidate.equals(Double.NaN)) { maxCandidate = next; } } } return newExtent(minCandidate, maxCandidate); } private  Extents(); static Extent<T> findMinMax(Collection<T> coll); @SuppressWarnings("unchecked") static Extent<T> newExtent(T min, T max); static Extent<T> emptyExtent();  }### Answer:
@Test public void testFindMinMax() { Extent<Integer> expectedIntExtent = Extents.newExtent(0, 9); Extent<Double> expectedDoubleExtent = Extents.newExtent(0.0, 9.0); Extent<Float> expectedFloatExtent = Extents.newExtent(0.0f, 9.0f); Extent<Long> expectedLongExtent = Extents.newExtent(0L, 9L); assertEquals(expectedIntExtent, Extents.findMinMax(intList)); assertEquals(expectedDoubleExtent, Extents.findMinMax(doubleList)); assertEquals(expectedFloatExtent, Extents.findMinMax(floatSet)); assertEquals(expectedLongExtent, Extents.findMinMax(longVector)); }