• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Question on a Mock Exam Question

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mr. Dan Chisholm, in the mock examDan Chisholm explains that LinkedHashMap organizes elements according to the hash method but also maintains order of insertion with a linked list. Please explain the implementation details of LinkedHashMap. I am thinking that it can either have a list based on the hashcode or a list based on order of insertion, but how can an implementation guarntee both properties concurrently? I think they would probably use two linked lists to get the desired behavior from LinkedHashMap. How do you think Sun implemented LinkedHashMap? Is it possible to have one linked list which keeps track of hash buckets and order of insertion or do we need two linked lists?

 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved from SCJP because of request for implementation details.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the distribution of the Java sdk you should find a file "src.zip" which will perhaps give you the answers you seek.
[ December 13, 2004: Message edited by: Barry Gaunt ]
 
Pay attention! Tiny ad!
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic