Java tutorial
//package com.java2s; import java.util.Iterator; public class Main { public static <T> T nth(Iterable<T> coll, int which) { Iterator<T> it = coll.iterator(); T ret = null; while (which-- >= 0) ret = it.next(); return ret; } }