News for hackers. Stuff that matters.
Re:From zero to 10M lines of Kotlin by vbezhenar on Tuesday October 25, 2022 @11:18AM (#33331750)
In your own code you should always use one of collection classes, usually Iterable, Collection or List, depending on which features you need.

Stream usually is not used other than for call chains. Like list.stream().map(...).toList();

I write Java for many years and I can't really say that this was source of pain for me. I agree that streams could be implemented with better ergonomics, but Java designers wanted to provide us means to use parallel computations with one extra word, so here we are. I've yet to find a place where I'd want to use that.

I used collection classes in Java 1.4 and I'm using them in Java 19 and I don't think that anything changed in that regard. Collections are the same.

Re:From zero to 10M lines of Kotlin by mcv on Tuesday October 25, 2022 @11:38AM (#33332050)
> In your own code you should always use one of collection classes, usually Iterable, Collection or List, depending on which features you need.

Yes, but every library I use requires or returns a different one.

> list.stream().map(...).toList()

But why not list.map(...)?

Re:From zero to 10M lines of Kotlin by kaeruct on Tuesday October 25, 2022 @01:08PM (#33333341)
In this specific case I think it is because stream operations can be implemented lazily - they only run once you call toList()