Java tutorial
import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main { public static void main(String args[]) { // create two array list objects List<String> arrlistsrc = new ArrayList<String>(); List<String> arrlisttarget = new ArrayList<String>(); // populate two lists arrlistsrc.add("A"); arrlistsrc.add("from java2s.com"); arrlistsrc.add("C"); arrlistsrc.add("D"); arrlistsrc.add("E"); arrlisttarget.add("C"); arrlisttarget.add("D"); arrlisttarget.add("E"); // check starting position of the last occurrence int index = Collections.lastIndexOfSubList(arrlistsrc, arrlisttarget); System.out.println("Starting position is: " + index); } }