Java examples for java.util:List Search
find Preceding Item in a List
//package com.java2s; import java.util.List; public class Main { public static <E> E findPrecedingItem(final List<E> list, final E item) { E lastSeenItem = null;//www.j a va 2 s. c o m for (E x : list) { if (x == item) { return lastSeenItem; } lastSeenItem = x; } return null; } }