Here you can find the source of get(T[] array, int index)
public static <T> T get(T[] array, int index)
//package com.java2s; //License from project: LGPL import java.util.*; public class Main { public static <T> T get(T[] array, int index) { if (array.length < index + 1) { return null; }/*from w w w . j a v a2 s. c o m*/ return array[index]; } public static <T> T get(final T[] array, final int index, final T defaultValue) { if (array.length < index + 1) { return defaultValue; } final T result = array[index]; return null != result ? result : defaultValue; // array[index]; } public static <T> T get(final Collection<T> collection, final int index) { if (collection.size() < index + 1) { return null; } int i = 0; for (T item : collection) { if (i == index) { return item; } i++; } return null; } public static int size(final Object[] array) { return null != array ? array.length : 0; } public static int size(final Collection collection) { return null != collection ? collection.size() : 0; } public static int size(final Map map) { return null != map ? map.size() : 0; } }