Java: state sharing between threads in functional programming
问题 My question is a more specific instantiation of this question: Functional programming: state vs. reassignment I'm a newbee to FP and trying to understand it through Java. I have the following class whose object is shared between multiple threads: public class Bank { private double[] accounts = new double[1000]; public synchronized void transfer(int from, int to, double amount) { account[from] -= amount; account[to] += amount; } } (This is a very simplified example, hence other details such as