Thursday 4 January 2018

Installation of RxJava



Reactive Java

Intellij Java IDE

1. RxJava
2. ReactiveStreams

How to Install library/dependency in Intellij

1. File  -->  Project Structure -->  Module  --> Dependency Tab
2. Click on (+)  --> Jar / Library / Dependency --> search with name



B. If you want to use math operator then add RxJava-Math library (available google drive(divakar1592singh)/rxjava folder )


---------------------------------


1. IntervalRange - Use blockingSubscriber instead of Subscriber
Reason - When using subscriber, application goint to terminate before output.

----------------------------------------------
import io.reactivex.Observable;

import java.util.Random;
import java.util.concurrent.TimeUnit;

public class HomeClass {

    public static void main(String[] args){

        fakeUserInputWithMap().blockingSubscribe(System.out::println);

    }

    public static Observable<Integer> fakeUserInputWithMap(){

        Random random = new Random();
        return Observable.intervalRange(0, 20, 500, 500, TimeUnit.MILLISECONDS).
                map(x -> random.nextInt(20));
    }

}

---------------------------------------------


WEBSITE

------------------------------------------------------
*http://reactivex.io/RxJava/javadoc/

https://ninmesara.github.io/RxPY/api/operators/empty-never-throw.html

-----------------------------------------------------

No comments:

Post a Comment

Calling method Sequencely

1. Execute multiple task sequencly (WAY-1) ------------------------------------------------------------------------------ import io.re...