Unruly Optics is a Lens, and other optics, library for Java 8.
A lens is a "composable getter and setter for immutable data structures". Shutters, prisms, traversals and one or two others are variations or generalisations of this basic idea.
Unruly Optics is heavily influenced by Monocle (Julien Truffaut, Scala), which in turn owes a lot to Control.Lens (Edward Kmett, Haskell). It's a widely used pattern for handling immutable data.
It's not yet in Maven central. Until it is, clone this repo, the run
mvn clean install. You can then include it as a maven dependency with a
<dependency>
<groupId>org.bruceeddy</groupId>
<artifactId>optics</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
Start by looking at the API provided by Lens and Shutter. Then, best place to start is the LensTest and ShutterTest, which have examples of each method of Lens and Shutter being used.
I work at Unruly. I did some of the work for this during my 20% time there, and I'm testing the ideas in the library on my colleagues.
It's called Optional in Monocle and Control.Lens. I've named it Shutter in Unruly.Optics, because Optional is already taken in Java 8.