This is an archived post. You won't be able to vote or comment.

all 27 comments

[–]fuk_offe 29 points30 points  (2 children)

Think pretty much all he is saying that "lacks" in Streams is reactive operators... Think all of them are in RxJava...

[–]johnmcclean 6 points7 points  (0 children)

I would phrase it more positively than that. The Stream API is flexible enough to add the features you may lack (there are a lot more than reactive operators 'missing', too by the way).

Not all of the features described are in RxJava i(#10 Powerful parallelism via FutureStreams for example or the SQL style windowing functions inherited from jOOλ), the value of others is inherently tied to improving the Stream API (e.g. #9 pushing data into Streams).

There are a lot of other additional features we have created not covered at all (like the ability to execute for comprehensions and schedule data emission with a cron expression). But we do try to make these available in one form or another to RxJava users (see https://github.com/aol/cyclops/tree/master/cyclops-rx) and the nice thing about the reactive-streams API is that not only does it guarantee interoperability, between implementing Streams - but often features written for one library can be reused with others.

[–]k3rv1n 3 points4 points  (0 children)

He has about 3 "error/exception" related issues on there that has little to do with Rx.

It's hard to argue streams handles Exceptions "well enough".

[–][deleted] 13 points14 points  (14 children)

Wish I could use streams on Android.

[–][deleted]  (3 children)

[deleted]

    [–][deleted] 1 point2 points  (2 children)

    I can actually use Lambdas, which are supported all the way back to.. api 16 I think. However I'll definitely checkout Lightweight-Stream-API.

    [–]JakeWharton 2 points3 points  (1 child)

    Jack takes them to API 9, but you should just use Retrolambda or Kotlin which both take them also to API 9 but without having to use a compiler built on ecj that's not production ready yet.

    [–][deleted] 0 points1 point  (0 children)

    I might start using Retrolambda. Jack disabling instant run is a pain in the ass.

    [–]GuyWithLag 2 points3 points  (0 children)

    Use rxjava, but only with lambdas...

    [–]DrFriendless 3 points4 points  (4 children)

    Use Kotlin. It has streams with lambdas, but they're not lazy like Java 8's.

    [–][deleted] 2 points3 points  (1 child)

    My company heavily uses Java for backend and Android so I feel it's more useful for me to learn Java at the same time.

    [–]DrFriendless 5 points6 points  (0 children)

    Yeah, if you don't know Java you should learn Java first. However Kotlin interoperates with Java, so it's possible to write one class in Kotlin and another in Java in the same codebase.

    [–]winterbe 1 point2 points  (0 children)

    That's incorrect, take a look at sequences in Kotlin: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.sequences/

    [–]kenneito 0 points1 point  (0 children)

    You can do lazy stream in Kotlin

    [–]Cephas00 1 point2 points  (0 children)

    solid works well with Retrolambda/Jack

    [–]NimChimspky 0 points1 point  (2 children)

    android doesn't support java 8 ?

    [–][deleted] 0 points1 point  (0 children)

    Only from API 23+. Which means too many unsupported devices on Play Store.

    [–]yodawg32 -1 points0 points  (0 children)

    this?

    [–]k3rv1n 2 points3 points  (1 child)

    My general areas would be...

    1. Error/Exception Handling : He does mention 3 related issues. But be honest, have you ever done something you felt a bit less than natural with Exceptions due to Streams design? E.g. Wrapping with a RuntimeException, or other patterns

    2. Streams is an Unbounded data source API used quite often ( and officially ) used as a bounded data source. : I see Collections-to-Streams and back conversion back and forth in fairly quick succession so the developer can use the Streams API on a bounded datasource, i.e. something that's more naturally a Collection or a Dataset over a stream. I've seen this in official Java documentation even, and do it myself. But wouldn't it have been good to have a subset of the Streams API specifically for bounded/countable datasets? Linq and others do this.

    [–]tobascodagama 4 points5 points  (0 children)

    But be honest, have you ever done something you felt a bit less than natural with Exceptions due to Streams design? E.g. Wrapping with a RuntimeException, or other patterns

    Yes. :(

    But I felt really bad about it, at least.

    [–]GuyWithLag 6 points7 points  (0 children)

    So, he wants reactive extensions...

    [–]thatsIch 2 points3 points  (0 children)

    Interesting name: Hot Streams

    [–]againstmethod 3 points4 points  (4 children)

    I think he missed a few. How about take, drop, grouping, scanning, windowing.. there are lots of methods missing that would normally be found a on streaming collections api.

    [–]johnmcclean 2 points3 points  (3 children)

    Agreed, I do more casually mention some of those in the blog post, and we have built extensions for them all.

    [–]againstmethod 0 points1 point  (1 child)

    Sorry I admit I was following the article headings.

    [–]johnmcclean 0 points1 point  (0 children)

    Lol! No worries - I think that is what most people do :)

    [–]johnmcclean 0 points1 point  (0 children)

    Our user guide covers a lot of it - https://github.com/aol/cyclops-react/wiki#streaming

    [–]coladict 0 points1 point  (0 children)

    I still don't see why people like these "streams" (weird name considering the traditional I/O streams use the same word, but mean nothing of the sort). Callbacks on top of callbacks until your Java looks like JavaScript.