Java LinkedList : get()

The get() method Returns the element at the specified position in linkedlist. Program       Program Source import java.util.LinkedList; public class Javaapp { public static void main(String[] args) { LinkedList list1 = new LinkedList(); list1.add(“AAAA”); list1.add(“BBBB”); list1.add(“CCCC”); list1.add(“DDDD”); list1.add(“EEEE”); list1.add(“FFFF”); for(int i=0;i < list1.size();i++) { System.out.println(list1.get(i)); } } }


The LinkedList class implements the List interface. Actuallly, the LinkedList class provides a linked-list data structure. Two important forms of the constructor of this class are as follows: LinkedListList() LinkedList ( Collection c ) When we use the first form of the constructor, an empty linked list will be formed. The second form of the … Read more…