Interview Question
Qus: What is the best approach to use collections in multi-threaded applications?
Immutable collection take a different approach in making collections thread-safe. As concurrent collections use synchronization locks instead, immutable collections can’t be changed after they are created. Automatically it makes them safe to use in multi-threaded scenarios since there’s no way for another thread to modify them and make the state inconsistent. This design decision definitely affects the API of immutable collection classes. They don’t even have public constructors.
Answers (2)