ConcurrentHashMap
uses multiple buckets to store data. This avoids read locks and greatly improves performance over a HashTable
. Both are thread safe, but there are obvious performance wins with ConcurrentHashMap
.
When you read from a ConcurrentHashMap
using get()
, there are no locks, contrary to the HashTable
for which all operations are simply synchronized. HashTable
was released in old versions of Java whereas ConcurrentHashMap
is a java 5+ thing.
HashMap
is the best thing to use in a single threaded application.
Related Posts:
- What are the differences between a HashMap and a Hashtable in Java?
- Hashtable, HashMap, HashSet , hash table concept in Java collection framework
- What is a hash function in java?
- Printing a java map Map
– How? - What is a hash function in java?
- Java associative-array
- Is a Python dictionary an example of a hash table?
- Exception in thread “main” java.lang.StackOverflowError
- Difference between HashSet and HashMap?
- Exception in thread “main” java.lang.StackOverflowError
- Iterate through a HashMap [duplicate]
- C# Java HashMap equivalent
- C# Java HashMap equivalent
- Iterate through a HashMap [duplicate]
- What is the significance of load factor in HashMap?
- How to update a value, given a key in a hashmap?
- Collision resolution in Java HashMap
- Difference between HashMap and Map in Java..?
- Java Hashmap: How to get key from value?
- Sorting HashMap by values
- How to sort Map values by key in Java?
- HashMap get/put complexity
- What is a hash map in programming and where can it be used
- What is the difference between the HashMap and Map objects in Java?
- “Cannot create generic array of ..” – how to create an Array of Map
? - Good Hash Function for Strings
- Map of maps – how to keep the inner maps as maps?
- toring and Retrieving ArrayList values from hashmap
- Problem with gif with transparent background
- Search for words with telephone numbers from 2-3-4 tree
- How to use Collections.sort() in Java?
- What is the best way to use a HashMap in C++?
- Java 8 Iterable.forEach() vs foreach loop
- How to round a number to n decimal places in Java
- Cannot make a static reference to the non-static method fxn(int) from the type Two [duplicate]
- How can I use pointers in Java?
- JavaFX – Exception in Application start method?
- Is there a stopwatch in Java?
- Why is there no SortedList in Java?
- Differences between “java -cp” and “java -jar”?
- Java Ordered Map
- How to convert any Object to String?
- Does Java support structs?
- How do I copy an object in Java?
- Unfortunately MyApp has stopped. How can I solve this?
- Which HTML Parser is the best?
- Best Java obfuscator?
- How do I resolve the “java.net.BindException: Address already in use: JVM_Bind” error?
- Gradle does not find tools.jar
- Constructor cannot be applied to given types?
- Mocking static methods with Mockito
- Java reverse an int value without using array
- Finding the max/min value in an array of primitives using Java
- How to for each the hashmap?
- Why do I get SQLCODE=-204, SQLSTATE=42704 with DB2 LUW and WebSphere App Server?
- java.net.UnknownHostException: Invalid hostname for server: local
- org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘demoRestController’
- What causes java.lang.IncompatibleClassChangeError?
- Shifting array to the right – homework
- How to get rid of Checkstyle message ‘File does not end with a newline.’
- trying to fix java Exception in thread “JavaFX Application Thread” java.lang.NullPointerException
- Uri not Absolute exception getting while calling Restful Webservice
- Very Basic Java
- SQLRecoverableException: I/O Exception: Connection reset
- What exactly is a Maven Snapshot and why do we need it?
- How to check if my string is equal to null?
- what is Ljava.lang.String;@
- The specified DSN contains an architecture mismatch between the Driver and Application. JAVA
- “Could not find Java SE Runtime Environment.” after installing Java
- Proxy Error 502 : The proxy server received an invalid response from an upstream server
- Java double.MAX_VALUE?
- how to do a system pause in java for debugging?
- Immutable class?
- Is spring default scope singleton or not?
- Java Reflection – Object is not an instance of declaring class
- What does “AL lib: alc_cleanup: 1 device not closed” mean?
- int cannot be converted to int []
- Joda DateTime to Timestamp conversion
- break statement in “if else” – java
- How to use Java AWT setBackground
- What is the difference between JSF, Servlet and JSP?
- Get only part of an Array in Java?
- How to Get JSON Array Within JSON Object?
- What is a class constant?
- How to represent a fix number of repeats in regular expression?
- How do I convert this for loop into a while loop?
- Java switch statement: Constant expression required, but it IS constant
- Resolving File paths – ‘File not found’ error in Eclipse
- How exactly do lookup tables work and how to implement them?
- Simple Coin Toss using random class in Java. The do while loop doesn’t seem to generate random results
- Why I am getting DefaultHttpClient is deprecated?
- When should you use multithreading? And would multi threading be beneficial if the different threads execute mutually independent tasks?
- KeyPressed event in java
- MessageBodyWriter not found for media type=application/json
- Conversion from Long to Double in Java
- Failed to find Java VM
- Java regex email
- What is the equivalent of Java’s System.out.println() in Javascript?
- Java Iterator on Doubly-linked-list
- Why “no projects found to import”?