Benefits and drawbacks of method chaining and a possibility to replace all void return parameters by the object itself

前端 未结 9 1791
隐瞒了意图╮
隐瞒了意图╮ 2020-11-29 06:58

I am mostly interested in Java, but I think it\'s a general question. Recently I\'ve been working with Arquillian framework (ShrinkWrap) that uses a lot of meth

9条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 07:16

    If you prefer immutability and functional programming, you never return void.

    A function without return value is only called for its side-effect.

    Of course there are situations where this is not applicable, but a function returning void could be considered as a hint to try it in a different way.

提交回复
热议问题