Hello, I have the following problem. Suppose we have an Account object. This object is an unchanged account, so we do overtime, we actually convert it to another state. For example, an Account may become ClosedAccount or NewAccount, and so on. Now, in some cases, my transitions are reflected in the Account, but something very small changes, for example, "modifiedDate". Since my account is its essence unchanged, even reflective operations still create new accounts with updated values. If my object is not immutable, I would use something like:
List<String> accountsIds;
accountIds.parrallelStream.map(t->NewAccount)
.map(t->Account)
.peek(t->changetheDate())
.map(t->closeAccount())
.forEach(bla bla bla)
Now the problem is that peek () will only change state for the mutable object. But in my case, the account is immutable, therefore, even if I create a new object, this object will not be broadcast further.
The question is whether the “Consumers” chain can be used in such a way that they work as “card” methods for displaying the “Consumer” in order to become the tab of the next “Consumer”. In other words, I am looking for a peek operation that works with immutable objects.
, , , , "" - , - , . , , , .