Here you can find the source of getLastBefore(List
public static <T> T getLastBefore(List<T> list)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static <T> T getLastBefore(List<T> list) { int size = list.size(); if (size >= 2) { return list.get(size - 2); } else {//from www. j av a 2s .c o m return null; } } }