Answer the question
In order to leave comments, you need to log in
Java, should reading collections or variables be Thread Safe?
I heard about Collections.synchronizedList, ConcurrentHashMap, CopyOnWriteArrayList, etc.
But I have a question, why can't I read a normal collection (without changing it) from different Thread. Or the same variable if it is final.
I would be very happy and grateful if someone could explain clearly.
Answer the question
In order to leave comments, you need to log in
why can't I read a regular collection (without modifying it) from different Threads
Or the same variable if it is final
I would be very happy and grateful if someone could explain clearly.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question