Java List.lastIndexOf(Object o)

Syntax

List.lastIndexOf(Object o) has the following syntax.

int lastIndexOf(Object o)

Example

In the following code shows how to use List.lastIndexOf(Object o) method.


import java.util.Arrays;
import java.util.List;
/*from w w w  .j  a  v  a  2  s. c  o  m*/
public class Main {
  public static void main(String[] a) {
    List list = Arrays.asList(new String[] { "A", "B", "C", "D" });
    System.out.println(list.lastIndexOf("A"));
  }
}

The code above generates the following result.