Accepted answer

You're correct: functional-looking code can be rendered non-functional when used by multiple threads if it uses internal state as part of its implementation. You can fix this by synchronizing every method that touches the mutable variables (i.e. with a synchronized block). Unfortunately, this is not ideal for performance, which is why in a threaded application functional implementations are often preferred.

Related Query

More Query from same tag