Here you can find the source of get(final Collection extends Object> list, final int pos)
@SuppressWarnings("unchecked") public static <T extends Object> T get(final Collection<? extends Object> list, final int pos)
//package com.java2s; /*/*w w w .j ava 2s . com*/ * Copyright (C) 2010 by Tobias Buchloh. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * If you didn't download this code from the following link, you should check if * you aren't using an obsolete version: * http://www.sourceforge.net/projects/KisKis */ import java.util.Collection; public class Main { @SuppressWarnings("unchecked") public static <T extends Object> T get(final Collection<? extends Object> list, final int pos) { int cnt = 0; for (final Object group : list) { if (cnt == pos) { return (T) group; } cnt += 1; } return null; } }