immutability, any good sources on writing immutable programs in a functional way with java?
shifting over to erlang - scala - clojure is not a possibility.
immutability, any good sources on writing immutable programs in a functional way with java?
shifting over to erlang - scala - clojure is not a possibility.
Java Concurrency in Practice has lots of good information about immutability. Basically you can write functionally (without regard to state) if you're not sharing state between invocations, write your state immutably, or write statelessly. Can you post something more specific about what you're trying to accomplish?
besides Java Concurrency in Practice, there also several good items in Effective Java (second edition)
Libraries like: Functional Java and lambdaj - and some others. Looks like this is a common requirement.
One thing to be careful of is if you use existing JVM libraries they may have nasties hidding inside - like use non-thread safe static variables. I think functional programming for concurrency is a great direction, but I think Erlang will always have the benefit of being designed for functional programming from the ground up. I think Scala will be big here, but suffer from the inability to guarantee isolatation of Actors (you cannot guarantee no mutable shared memory between actors/threads).