<div dir="auto">Greetings to everyone on the list.<div dir="auto"><br></div><div dir="auto">When working on some routine tasks recently, I have encountered a, seemingly to me, strange decision in design of Stream.concat method, specifically the fact that it accepts exactly two streams. My concrete example was something along the lines of</div><div dir="auto"><br></div><div dir="auto">var studentIds = ...;</div><div dir="auto">var teacherIds = ...;</div><div dir="auto">var partnerIds = ...;</div><div dir="auto"><br></div><div dir="auto">return Stream.concat(</div><div dir="auto">    studentIds.stream(),</div><div dir="auto">    teacherIds.stream(),</div><div dir="auto">    partnerIds.stream() // oops, this one doesn't work</div><div dir="auto">)</div><div dir="auto"><br></div><div dir="auto">so I had to transform concat to a rather ugly</div><div dir="auto">Stream.concat(</div><div dir="auto">    studentIds.stream(),</div><div dir="auto">    Stream.concat(</div><div dir="auto">        teacherIds.stream(),</div><div dir="auto">        partnerIds.stream()</div><div dir="auto">    )</div><div dir="auto">)</div><div dir="auto"><br></div><div dir="auto">Later on I had to add 4th stream of a single element (Stream.of), and this one became even more ugly</div><div dir="auto"><br></div><div dir="auto">When I first wrote third argument to concat and saw that IDE highlights it as error, I was very surprised. This design seems inconsistent not only with the whole java stdlib, but even with Stream.of static method of the same class. Is there any particular reason why concat takes exactly to arguments?</div><div dir="auto"><br></div><div dir="auto">I would say that, even if just in a form of sugar method that just does reduce on array (varagrs) of streams, this would be a great quality of life improvement, but I'm sure there also may be some room for performance improvement.</div><div dir="auto"><br></div><div dir="auto">Of course, there are workarounds like Stream.of + flatmap, but:</div><div dir="auto"><br></div><div dir="auto">1. It gets messy when trying to concat streams of literal elements set (Stream.of) and streams of collections or arrays</div><div dir="auto">2. It certainly has significant performance overhead</div><div dir="auto">3. It still doesn't explain absence of varagrs overload of concat</div><div dir="auto"><br></div><div dir="auto">So, once again, is there any particular reason to restrict arguments list to exactly two streams? If not, I would be happy to contribute Stream.concat(Stream... streams) overload.</div><div dir="auto"><br></div><div dir="auto">Best regards</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div></div>