LinkedList (Generics)

28 June 2008

Like Vectors and ArrayLists, LinkedList can also be made to deal with only one type of objects. Lets see how to do that.

LinkedList<String> ll = new LinkedList<String>();
ll.add("Str1");
ll.add("Str2");
ll.addFirst("Str3");

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.

del.icio.us:LinkedList (Generics)  digg:LinkedList (Generics)  spurl:LinkedList (Generics)  wists:LinkedList (Generics)  simpy:LinkedList (Generics)  newsvine:LinkedList (Generics)  blinklist:LinkedList (Generics)  furl:LinkedList (Generics)  reddit:LinkedList (Generics)  fark:LinkedList (Generics)  blogmarks:LinkedList (Generics)  Y!:LinkedList (Generics)  smarking:LinkedList (Generics)  magnolia:LinkedList (Generics)  segnalo:LinkedList (Generics)  gifttagging:LinkedList (Generics)

Top Of Page | Trackback

If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.

It will look like this: LinkedList (Generics)

Leave a Reply