Java tutorial
//package com.java2s; import java.util.Iterator; public class Main { public static <T> Iterable<T> iterableOf(final Iterator<T> keys) { return new Iterable<T>() { public Iterator<T> iterator() { return keys; } }; } }