On Tue, 11 Sep 2018 at 10:25, Alan Bateman <[email protected]> wrote: > On 10/09/2018 21:55, Roger Riggs wrote: > > Nope! there's quoting on Windows that gets short changed with that > > work around. > > > > Other opinions?, Suggestions? > One suggestion is reduce this down to one method that returns a stream > rather than a collection. It could work lazily if you want. Something like: > > Stream<String> splitSearchPath(String input) > > is a lot more flexible (in my view) and the places where we use Path > objects can use .map(Path::of).
This is a broader question for new methods in the JDK, not just this one. I don't think anyone has come up with a "style guide" for when to use Stream returning as opposed to list-returning methods. What I can say is that I think List is the better fit here, because: - the result is not large - the result may well be stored somewhere (method should guarantee result is immutable) - a List is simpler conceptually than Stream as a result type (eg. serial vs parallel) Personally, I only tend to return Stream if I the particular method is returning a very large data set. Stephen
