public static <T> Stream<T> asStream(final Iterator<T> source) { final Iterable<T> iterable = () -> source; return StreamSupport.stream(iterable.spliterator(), false); }
public static <E> E getOnlyElement(Iterable<E> traversal, E defaultElement) { return getOnlyElement(traversal.iterator(), defaultElement); }
public static void verifyElementOrder( Iterable<? extends Element> elements, String key, Order order, int expectedCount) { verifyElementOrder(elements.iterator(), key, order, expectedCount); }
public static <E> E getOnlyElement(Iterable<E> traversal) { return getOnlyElement(traversal.iterator()); }