Qus:    What is the best approach to use collections in multi-threaded applications?
Nov 23, 2020 14:45 2 Answers Views: 694 RAMU

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.

Prev Next
Answers (2)
PARTH Nov 24, 2020 08:14
Answer:   The concurrent collection classes can be safely used in multi-threaded applications. Immutable collections can’t be changed after they are created, so can also use them in multi-threaded applications.

DIVYA Nov 24, 2020 08:40
Answer:   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.

Post Your Answer
Guest User

Not sure what course is right for you?

Choose the right course for you.
Get the help of our experts and find a course that best suits your needs.


Let`s Connect