Java examples for Collection Framework:LinkedList
Get elements from LinkedList
import java.util.LinkedList; public class Main { public static void main(String[] args) { //create LinkedList object LinkedList lList = new LinkedList(); //from w w w.ja va 2 s . c o m //add elements to LinkedList lList.add("1"); lList.add("2"); lList.add("3"); lList.add("4"); lList.add("5"); System.out.println("LinkedList contains : "); for(int i=0; i< lList.size(); i++) { System.out.println(lList.get(i)); } } }