All Questions
20 questions
0
votes
1
answer
168
views
RxJava real World Usecase Scenario
Currently im learning how to use RxJava. I fully understand the concept of the reactive Programming paradigma where the programm needs to react to certain types of changes (Userinputs, Sensordata, etc....
0
votes
1
answer
2k
views
Nested Single.flatMap in RxJava vs Single.zip, are the same?
I'm facing a confusion, giving by example 4 Single:
val s1 : Single<String> = service1.execute().subscribeOn(io())
val s2 : Single<Int> = service2.execute().subscribeOn(io())
val s3 : ...
3
votes
1
answer
1k
views
RxJava: merge() changes the order of the emitted items?
Look at these 2 small tests:
@Test
public void test1() {
Observable.range(1, 10)
.groupBy(v -> v % 2 == 0)
.flatMap(group -> {
if (group.getKey()) {
...
3
votes
2
answers
965
views
Is RxJava a good fit for branching workflows?
I am using RxJava to process some notifications that we pull from a queue.
RxJava seemed to work fine with a simple workflow, now with new requirements coming in, the flow is growing in complexity ...
1
vote
3
answers
419
views
RxJava - groupBy, toMap and flatMap not working well together?
I would expect this small example to print all numbers which are divisible by 3.
@Test
public void test() {
Observable.range(1, 100)
.groupBy(n -> n % 3)
.toMap(g -> ...
0
votes
1
answer
518
views
RxJava - map different functions after a groupBy
Let's say I have an Observable emitting Integers. I would like to add 1 to all odd numbers and subtract 1 to all even numbers.
What would be a clean way of achieving this with RxJava?
I am ...
1
vote
1
answer
4k
views
Buffer Operator on Java 8 Streams
I am trying to write a java 8 stream collector which mirrors the functionality of rxjava buffer operator
I have a working code for this:
// This will gather numbers 1 to 13 and combine them in ...
1
vote
1
answer
198
views
Lazy compose Observables
Say I have this
Observable<A> getA() {
return Observable.just(new A());
}
Observable<C> getC() {
// ... some expensive call
return Observable.just(new C());
}
Observable<B> ...
0
votes
1
answer
620
views
RxJava: OnErrorFailedException. Identifying the correct cause
Being inspired by T.Nurkiewicz's "Reactive Programming with RxJava" I tried to apply it in a project that I am working on and here's the issue that I am facing.
I have a Rest end point that takes an ...
1
vote
1
answer
875
views
Find if there's at least one - Observable Java 8 Rx
I have an Observable<SomeObject> for which I need to test that there's at least one element of value "thing" (not a stream, I suppose) respecting a condition (it's for a unit test, so I'd need ...
0
votes
1
answer
169
views
Can I parallelise an operation driven by a flatMap?
Say I have a method like the code below, in which a List is flatMapped to individual strings, each of which has some expensive operation applied to them. Is there any way to parallelise the expensive ...
2
votes
1
answer
1k
views
rxJava remove list element by filter list
I have listA={a,b,c,d,e,f,g} and listB={0,4,5}
and I want remove element of listA by listB values(use by index)
so I want to get a result [b,c,d,g] which mean "[x,b,c,d,x,x,g]"
is there way to use ...
0
votes
2
answers
637
views
How to process each item differently in a Observable stream(RxJava)
Let me put an example: Given the stream of numbers from 1 to 10, process even and odd numbers differently. Process odd numbers in a different thread and apply this transformation to them (2 * i). ...
6
votes
2
answers
2k
views
Using RxJava for email login validation, an observable is emitting twice
I'm making a simple login form (email and password) to try and bolster my reactive programming skillset. I'm having some trouble getting the email field validation to work the way I want it.
Here's ...
1
vote
1
answer
270
views
How to correctly understand behavior of RxJava's groupBy?
I'm pretty new to RxJava and FP in general. I want to write a code to join two Observables. Let's say we have two sets of integers:
[0..4] with key selector as modulo of 2, giving (key, value) = {(0,0)...