Why didn’t Stream have a toList() method?

Recently I wrote a small library called StreamEx which extends Java streams and provides this exact method among many other features:

StreamEx.of(-2,1,2,-5)
    .filter(n -> n > 0)
    .map(n -> n * n)
    .toList();

Also toSet(), toCollection(Supplier), joining(), groupingBy() and other shortcut methods are available there.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)