• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java Collections - Internal Working

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone let me know how the java collections work internally?

For example, how do the collections LinkedList, ArrayList, HashMap, LinkedHashMap, HashSet, LinkedHashSet work?

Does the LinkedList, LinkedHashMap, LinkedHashSet have a single linked list or double linked list internally?

How does hashing work internally in HashMap, LinkedHashMap, HashSet, LinkedHashSet?

The more details the better for me. If you can explain me or direct me to material that explains this, then I shall be really grateful.

Thanks.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

R Ak wrote:


Please check your private messages for an important administrative matter
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you installed the JDK on your machine.
Look for a file called src.zip in the JDK installation directory. That contains the source code for the Java classes. It should give you a clear picture about the implementation.
 
Ak Rahul
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks maneesh. Can you direct me to some text that explains this, instead of reading the JDK source code, since I also want to know which one has better performance, etc.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See The Collections Framework, which contains links to several other pages including a Design FAQ.
 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rahul Ak wrote:thanks maneesh. Can you direct me to some text that explains this, instead of reading the JDK source code, since I also want to know which one has better performance, etc.



What you need is a general knowledge of the basic standard data structures such as arrays, list, trees and hash tables.

Then you need to look at the Sun API specification to find out the exact properties of a specific collection. It's usually detailed enougth to know what to expect. And by relying on this information only your code becomes implementation independent. This is because the API specifications from Sun work as a standard for the Java language. Trying to "envision" the properties of a collection by seccondguessing its internal workings or looking at an implementation will lead you wrong.
 
Ak Rahul
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for all responses. I really appreciate your help.


regards,
Rahul
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic