Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

LinkedHashSet and LinkedHashMap

 
Sim Kim
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For LinkedHashMap the Java API says
A special constructor is provided to create a linked hash map whose order of iteration is the order in which its entries were last accessed, from least-recently accessed to most-recently (access-order). This kind of map is well-suited to building LRU caches.


Does LinkedHashSet also has the same facility ? According to Kathy and Bert's book they say that you can access elements by two ways in LinkedHashSet : one by insertion order and other by last accessorder . How can you use that ?
 
Mike Gershman
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I saw it in K&B, but I didn't see it in the API doc or in the source code.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to Kathy and Bert's book they say that you can access elements by two ways in LinkedHashSet : one by insertion order and other by last accessorder


For last access oprder , Please read my thread posted on LinkedHashSet.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic