Here you can find the source of get(Collection coll, int index)
public static Object get(Collection coll, int index)
//package com.java2s; /**/*from www . j av a 2s. c o m*/ * Copyright (c) 2004-2011 Wang Jinbao(Julian Wong), http://www.ralasafe.com * Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php */ import java.util.Collection; import java.util.Iterator; import java.util.List; public class Main { public static Object get(Collection coll, int index) { if (coll instanceof List) { return ((List) coll).get(index); } else { int i = 0; for (Iterator iter = coll.iterator(); iter.hasNext();) { Object object = (Object) iter.next(); if (i == index) { return object; } i++; } } return null; } }