Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

In your examples you are modifying the collection that you are iterating over. To avoid the concurrent modification exception why not collect up a number of objects you want to remove and remove them post iteration?
- Ed
I want to start learning java,please help me how can I learn and improve?
- sima
I don’t get your explanation as why: “It is taking the new object added with key “4″ but not the next added object with key “5″.” Can you clarify this? Why iterator for ConcurrentHashMap considers 4 but not 5? Debugging this the keyset gets updates and iterator only sees 4 and not 5
- Siavash
niche questionire. thanks to you sir for ur valuable supprot through yours site for the Interviewees.
- chandra prakash
Map Value:1 Map Value:null Map Value:4 Map Value:2 Map Size:4 It is taking the new object added with key “4″ but not the next added object with key “5″. What is the reason for this behavior of concurrenthashmap , is it because of 1st its finds the segment and the it find the location of bucket where actually values goes , is that not happening here or i’m missing something , let me know ?
- shashank
Hi, Could u please explain me , how come size of myList is 6 though you are adding 5 elements to it in the above program.
- Myrna
for(int i = 0; i<myList.size(); i++){ System.out.println(myList.get(i)); if(myList.get(i).equals(“3”)){ myList.remove(i); i–; myList.add(“6”); } } Getting ArraysIndexOutOfBoundsException with this code…could you please explain?
- SwethaHarshini
For the List use case, instead of myList.remove(object), using it.remove() works.
- Tiru