Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8398869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:09:21+00:00 2026-06-09T21:09:21+00:00

ConcurrentHashMap was introduced in 1.5 as a part java java.util.concurrent package. Before that the

  • 0

ConcurrentHashMap was introduced in 1.5 as a part java java.util.concurrent package. Before that the only way to have a threadsafe map was to use HashTable or Collections.synchronizedMap(Map).

For all the practical purpose (multithread environment),ConcurrentHashMap is sufficient to address the needs except one case wherein a thread needs a uniform view of the map.

My question is, apart from having a Uniform View of the map, are there any other scenarios wherein ConcurrentHashMap is not an option ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:09:22+00:00Added an answer on June 9, 2026 at 9:09 pm

    This is a stretch but I will give it as a use case.

    If you needed a thread-safe Map implementation which you can do some extra compound operation on which isn’t available via ConcurrentMap. Let’s say you want to ensure two other objects don’t exist before adding a third.

    Hashtable t = new Hashtable();
    
    synchronized(t){
       if(!t.contains(object1) && !t.contains(object2)){
          t.put(object3,object3);
       }
    }
    

    Again this is a stretch, but you would not be able to achieve this with a CHM while ensuring atomicity and thread-safety. Because all operations of a Hashtable and its synchronizedMap counter part synchronize on the instance of the Map this ensures thread-safety.

    At the end of the day I would seldom, if ever, use a synchronizedMap/Hashtable and I suggest you should do the same.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read somewhere that in ConcurrentHashMap , the whole map object is not
I have ConcurrentHashMap that I store in the servlet context, data in the map
A data structure that I use commonly in multi-threaded applications is a ConcurrentHashMap where
What is the use of ConcurrentHashMap in Java? What are its benefits? How does
If in a class I have a ConcurrentHashMap instance that will be modified and
In Java, ConcurrentHashMap is there for better multithreading solution. Then when should I use
I have these classes that I use to create objects that I want to
I have a ConcurrentHashMap in the below format: ConcurrentHashMap<String,ConcurrentHashMap<String,ArrayList>> Now in this map,I want
I have a java class that is accessed by a lot of threads at
I have a ConcurrentMap<String, SoftReference<X>> map = new ConcurrentHashMap<String, SoftReference<X>>(); and would like the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.