Here you can find the source of get(Collection> arr, int idx)
Parameter | Description |
---|---|
arr | a parameter |
oid | a parameter |
public static Object get(Collection<?> arr, int idx)
//package com.java2s; //License from project: Open Source License import java.util.Collection; import java.util.Iterator; public class Main { /**// www . j a v a 2 s . c o m * @param arr * @param oid * @return */ public static Object get(Collection<?> arr, int idx) { if (idx < 0) return null; for (Iterator<?> i = arr.iterator(); i.hasNext(); idx--) { Object b = i.next(); if (idx <= 0) return b; } return null; } }