• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Source code for java.util.ArrayList

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends,
Where can I find the source code for java.util.ArrayList and java.util.LinkedList ?
Basically I wanted to do a comparision as to why ArrayList is more efficient than LinkedList in case of iteration.
Also why is the Capacity idiom there in ArrayList when it is not required in a LinkedList ?
Except for the method ensureCapacity(), all other imp. methods of ArrayList r there in LinkedList. Both r indexed based datastructures with LinkedList having more functionality than ArrayList. So why should one use an ArrayList at all ? The only explanation is, an ArrayList is more efficient ...
which I am not able to visualize :roll: unless n until I see the source code.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your download of the SDK should have come with a src.jar or src.zip that contains the source code for the standard Java library.
Every student of Java should have that file unzipped and available for study.
Bill
 
Ranch Hand
Posts: 787
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
posted by Gopal shah:


Basically I wanted to do a comparision as to why ArrayList is more efficient than LinkedList in case of iteration.


I thought that LinkedList will be more efficient for iteration as all link is there to call next element faster.
Any comments.
 
reply
    Bookmark Topic Watch Topic
  • New Topic