Here you can find the source of createIterable(final Iterator
public static <X> Iterable<X> createIterable(final Iterator<X> src)
//package com.java2s; //License from project: Open Source License import java.util.Iterator; public class Main { public static <X> Iterable<X> createIterable(final Iterator<X> src) { return new Iterable<X>() { public Iterator<X> iterator() { return src; }/*from ww w . jav a2 s . c om*/ }; } }