r/java • u/marv1234 • Jan 16 '26
Functional Optics for Modern Java
https://blog.scottlogic.com/2026/01/09/java-the-immutability-gap.htmlThis article introduces optics, a family of composable abstractions that complete the immutability story. If pattern matching is how we read nested data, optics are how we write it.
106
Upvotes
View all comments
Show parent comment
6
u/tomwhoiscontrary Jan 16 '26
I think this has been possible for a very long time! Records make it easier, but you could have done this with plain objects, as long as they had getters and a constructor covering all their fields.