mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-04 08:13:20 +00:00
fix: website build failed
This commit is contained in:
1 parent
7b4482f08c
commit
3b9a2df119
2 files changed
-25
No files matched your search
@@ -33,10 +33,6 @@ Wikipedia says
|
||||
|
||||
> In object-oriented and functional programming, an immutable object (unchangeable object) is an object whose state cannot be modified after it is created. This is in contrast to a mutable object (changeable object), which can be modified after it is created.
|
||||
|
||||
Class diagram
|
||||
|
||||

|
||||
|
||||
## Programmatic Example of Immutable Pattern in Java
|
||||
|
||||
The core of the pattern is `ImmutableUser`. All fields are `final`, the mutable `roles` list is defensively copied via `List.copyOf`, and "mutation" is expressed by returning a new instance.
|
||||
|
||||
Reference in new issue
Block a user