You have a data structure with internal state that can be mutated in place by a method call.
Make the internal state immutable, and convert the mutator into a method that makes a deep copy of the data structure, with the corresponding mutation applied.
This is a functional take on the builder pattern.
Mutable variables tend to preclude referential transparency, and can lead to all kind of bugs related to timing, threading, parallelism, lack of idempotency, evaluation order, lack of equational reasoning, etc.
Make internal state final. In Scala, this means simply replacing
Make mutator methods, which probably have no useful return information, return the type of the data structure.
Change the implementations of mutator methods to construct new instances of the data structure, propagating the existing state plus the change(s) implied by the mutator.
In Scala, we get this pattern for free when we use case classes:
employee1: CCEmployee(George Michael,Employee) employee2: CCEmployee(George Michael,Mr. Manager)