Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsLastIndexOfSubListExample3 { public static void main(String[] args) { //Creating array list with values List
l1 = Arrays.asList("kitu mani raj karthi rahul gagan".split(" ")); //Printing array list System.out.println("List :" + l1); //Sublist which we need IndexOf List
sublist = Arrays.asList("karthi rahul".split(" ")); Integer Index = Collections.lastIndexOfSubList(l1, sublist); //Printing Last IndexOfSublist System.out.println("Last IndexOfSubList: " +Index); } }
Output