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

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 ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic