Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.CopyOnWriteArrayList; public class CopyOnWriteArrayListLastIndexOfExample2{ public static void main(String[] args) { //Initializing CopyOnWriteArrayList of Integers CopyOnWriteArrayList
numbers = new CopyOnWriteArrayList<>(new Integer[] {1,2,1,4,5,3,3,3}); //Prints the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element. System.out.println("Index of 11 is : " + numbers.lastIndexOf(11)); } }
Output