News for hackers. Stuff that matters.
Re:Java 9 features announced by vetler on Tuesday August 19, 2014 @08:23AM (#8196930)
Here's a tip: instead of changing your objects, you can create a new object with the same values except the ones you want to change.

Another option is to use builders (that are mutable), to build/copy your immutable business (?) objects.

Re:Java 9 features announced by mercurial on Tuesday August 19, 2014 @08:43AM (#8196990)
That's what we do at work. Then when work is done, I look at OCaml and repeat the mantra "I'm not going to think about how many lines it takes in Java to do a functional update 'let foo2 = { foo1 with foo_field = "bar" }'".

It is possible to have immutable objects in Java and have the equivalent of functional updates, but it's a hell of a lot of pointless boilerplate. It still beats traditional Java beans, though.