by, 11-03-2011 at 01:07 PM (1305 Views)
Like Vectors and ArrayLists, LinkedList can also be made to deal with only one type of objects. Lets see how to do that.
The LinkedList named ll can only store String objects. This is very useful and provides more control over collection. You are always sure that you will get objects of a specific type from the list.Java Code:LinkedList ll = new LinkedList(); ll.add("Str1"); ll.add("Str2"); ll.addFirst("Str3");