Here you can find the source of getLast(T[] l)
public static <T> T getLast(T[] l)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static <T> T getLast(List<T> l) { return get(l, -1); }//from ww w . j a va 2s.c o m public static <T> T getLast(T[] l) { return get(l, -1); } public static <T> T get(List<T> l, int i) { return get(l, i, null); } public static <T> T get(List<T> l, int i, T defValue) { if (i < 0) i += l.size(); if (i < 0 || i >= l.size()) return defValue; return l.get(i); } public static <T> T get(T[] l, int i) { return get(l, i, null); } public static <T> T get(T[] l, int i, T defValue) { if (i < 0) i += l.length; if (i < 0 || i >= l.length) return defValue; return l[i]; } public static double get(double[] l, int i, double defValue) { if (i < 0) i += l.length; if (i < 0 || i >= l.length) return defValue; return l[i]; } }