Embed presentation
Download to read offline









This document discusses immutability in Scala. It recommends immutability to avoid unexpected values, concurrent state issues, and most container types are immutable by default. It provides examples of using vals for immutable variables, creating new instances instead of modifying existing ones, using the copy method for case classes, and hiding vars to prevent external modification of mutable state. It cautions being mindful of modifying immutable nested structures, fields initialized each instance, and closing over mutable state.







