I was using a Stream.Builder
and I stumbled upon the fact that this interface has both the methods accept(T t)
and add(T t)
. The only difference is that the former returns void
and the latter returns a Stream.Builder
.
The documentation even mentions these methods to have the same default implementation:
The default implementation behaves as if:
accept(t) return this;
Note that they forgot a semicolon, but that's another story.
My question is: why do they have two methods to add something to the stream builder? I think this clutters the API, and I thought they wanted to avoid that.
Is there any compelling reason to do so?