Here you can find the source of iterable(final Iterator iterator)
Parameter | Description |
---|---|
I | a parameter |
iterator | a parameter |
public static <I> Iterable<I> iterable(final Iterator<I> iterator)
//package com.java2s; //License from project: Apache License import java.util.Iterator; public class Main { /**/*from w w w . jav a 2 s.c o m*/ * Makes an Interator iterable with foreach * * @param <I> * @param iterator * @return */ public static <I> Iterable<I> iterable(final Iterator<I> iterator) { return new Iterable<I>() { @Override public Iterator<I> iterator() { return iterator; } }; } }