• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between NavigableMap and ConcurrentNavigableMap

 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are some additions to the Java Collection Framework, I tried to find out but could not drill down what is actually difference between "NavigableMap" and "ConcurrentNavigableMap".

Is it ConcurrentNavigableMap can be modified by different threads only?
 
Mike Simmons
Ranch Hand
Posts: 3090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A ConcurrentNavigableMap has all the methods of a NavigableMap, plus all the methods of a ConcurrentMap. Other NavigableMaps do not have ConcurrentMap methods.

Is it ConcurrentNavigableMap can be modified by different threads only?

No - if for some reason you want to modify a ConcurrentNavigableMap using only one thread, that's fine, it will work normally. The point is that if you do have multiple threads accessing a Map, you need a ConcurrentMap.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic