Sharing mutable collections directly can lead to unintended modifications and data inconsistencies.
If a class exposes a mutable collection directly, other parts of the program can alter its state, causing bugs. For instance, in an e-commerce app, directly exposing a list of discounts can lead to unauthorized changes, affecting pricing accuracy.
Additional Notes
What risks do mutable collections pose if shared directly?