### Question:
IteratorUtils { public static <T> Optional<T> next(Iterator<T> it) { if (it.hasNext()) { T entry = it.next(); return Optional.of(entry); } return Optional.empty(); }  static Optional<T> next(Iterator<T> it); static OptionalDouble next(OfDouble it);  }### Answer:
@Test public void testNext() { List<Integer> list = Collections.singletonList(1); Iterator<Integer> it = list.iterator(); assertThat(IteratorUtils.next(it)).hasValue(1); assertThat(IteratorUtils.next(it)).isEmpty(); }
@Test public void testNextDouble() { DoubleList list = DoubleLists.singleton(1.0); OfDouble it = list.iterator(); assertThat(IteratorUtils.next(it).boxed()).hasValue(1.0); assertThat(IteratorUtils.next(it).boxed()).isEmpty(); }