Java ArrayList lastIndexOf方法 Java ArrayList isEmpty方法 Java ArrayList remove方法 Java ArrayList lastIndexOf方法 package com.codingdict; import java.util.ArrayList; public class ArrayListDemo { public static void main(String[] args) { // create an empty array list with an initial capacity ArrayList<String> arrlist = new ArrayList<String>(5); // use add() method to add values in the list arrlist.add("G"); arrlist.add("E"); arrlist.add("F"); arrlist.add("M"); arrlist.add("E"); System.out.println("Size of list: " + arrlist.size()); // let us print all the values available in list for (String value : arrlist) { System.out.println("Value = " + value); } // Retrieving the index of last occurrence of element "E" int retval=arrlist.lastIndexOf("E"); System.out.println("The last occurrence of E is at index " + retval); } } Java ArrayList isEmpty方法 Java ArrayList remove方法