Streams for sure
# android
k
Streams for sure
l
Is there even a use case, for which one would prefer Streams over Rx Observables ?
k
Sure, they are very different things
Parallel execution for example
l
I know they are very different in nature. Parallel is now in form of ParallelFlowable. But I was wondering if you know any real use case for that ? Because I don’t see any
f
Anytime you're working with a normal list I'd say. You can turn
Copy code
List<String> items = ...
List<String> result = new ArrayList()
for (String item : items) {
    if (item.startsWith('42')) {
        result.add(item)
    }
}
into
Copy code
List<String> items = ...
List<String> result = items.stream().
    .filter(item -> item.startswith('42'))
    .collect(Collectors.toList());
Sometimes wrapping something in RxJava before using it can be a bit overkill imo. (It feels like there should also be a performance difference, but I'm not sure on that). Plus not every project might actually have a use for RxJava, and this way you have one less dependency.
👍 1