Java tutorial
import java.util.LinkedList; public class Main { public static void main(String[] args) { // create a LinkedList LinkedList<String> list = new LinkedList<String>(); // add some elements list.add("Hello"); list.add("from java2s.com"); list.add("10"); // print the list System.out.println("LinkedList:" + list); // get the last index for "Hello" System.out.println("Index for Hello:" + list.lastIndexOf("Hello")); // get the index for "Coffee" System.out.println("Index for Coffee:" + list.indexOf("Coffee")); } }