Here you can find the source of toIterable(final Iterator
Parameter | Description |
---|---|
iterator | the iterator |
T | the type |
public static <T> Iterable<T> toIterable(final Iterator<T> iterator)
//package com.java2s; //License from project: Open Source License import java.util.Iterator; public class Main { /**// w ww . j a v a 2 s .c o m * Create an {@link Iterable} from an {@link Iterator}. * * @param iterator * the iterator * @param <T> * the type * @return the iterable */ public static <T> Iterable<T> toIterable(final Iterator<T> iterator) { return () -> iterator; } }