001package org.gbif.utils.collection;
002
003import java.util.Iterator;
004
005public class IterableUtils {
006
007  /**
008   * Converts an interator into an Iterable for one time use only.
009   * If used more than once with the same iterator this will not reset/restart the iteration!
010   */
011  public static <T> Iterable<T> iterable(final Iterator<T> it){
012    return new Iterable<T>(){
013      public Iterator<T> iterator(){
014        return it;
015      }
016    };
017  }
018}