synchronizedList access by multiple threads
I have very basic question about the SynchronizedList.
Lets say I have synchronizedList as -
List syncList = Collections.synchronizedList(new ArrayList<>())
Now my scenario is Thread A is trying to access add() api and Thread B
trying to access remove() api of synchronizedList. Will the Both thread
able to access the Both(add and remove) api at the same time.
I believe the threads should not access the api(add() and remove()) same
time. Please correct me if I am wrong.
No comments:
Post a Comment