This documentation is archived and is not being maintained.

List.lastIndexOf Method

Visual Studio 2005

Retrieves the last index of the specified element.

Package: java.util

Assembly: vjslib (in vjslib.dll)

public abstract int lastIndexOf(
    java.lang.Object e);



The element whose last index is retrieved.

The last index of the element.

// list-lastidx1.jsl
// List.lastIndexOf example

import java.util.*;

public class MyClass
    public static void main(String[] args)
        // Create a linked list object:
        LinkedList lList =  new LinkedList();

        // Add some elements:
        lList.add("My node");
        lList.add("Her node");
        lList.add("Their node");
        lList.add("Your node");
        lList.add("Her node");    

        // Print the last index of "Her node":
        System.out.println("The lst index is: " +
                           lList.lastIndexOf("Her node"));

The lst index is: 4