I have an HashMap
as:
Map<Integer ,ArrayList<Double>> map1 = new HasMap<Integer,ArrayList<Double>>()
This map is accessed and modified by some number of threads. I would like to make thread safe update for the granularity level of each of the component of ArrayList
. It means, one value can be modified by several threads but one component can not be modified by several threads. How can I do it? Does this prevents from "undefined property" while iterating? iterating values
[EDIT]
key value
1000 [0.1,0.002,0.8,0.112]
Each of the components of value is updated. While updating, first component can be updated by one thread and second by another thread at a time. I don't want to lock a pair for one thread only.