In Java streams is peek really only for debugging?

后端 未结 6 658
误落风尘
误落风尘 2020-11-22 03:40

I\'m reading up about Java streams and discovering new things as I go along. One of the new things I found was the peek() function. Almost everything I\'ve read

6条回答
  •  遥遥无期
    2020-11-22 04:28

    The functional solution is to make account object immutable. So account.login() must return a new account object. This will mean that the map operation can be used for login instead of peek.

提交回复
热议问题