Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.Collection;
import java.util.Iterator;

public class Main {
    public static <T> T get(final Collection<T> coll, final int index) {
        final Iterator<T> it = coll.iterator();
        int i = 0;
        T ret = null;
        while (it.hasNext()) {
            ret = it.next();
            if (i >= index)
                break;
            i++;
        }
        return ret;
    }
}