June 2018
Beginner
722 pages
18h 47m
English
Here are six of the methods that allow you to create io.reactivex.Observable:
//1Observable.just("Hi!").subscribe(System.out::println); //prints: Hi!//2Observable.fromIterable(List.of("1","2","3")) .subscribe(System.out::print); //prints: 123System.out.println();//3String[] arr = {"1","2","3"};Observable.fromArray(arr).subscribe(System.out::print); //prints: 123System.out.println();//4Observable.fromCallable(()->123) .subscribe(System.out::println); //prints: 123//5ExecutorService pool = Executors.newSingleThreadExecutor();Future<String> future = pool .submit(() -> { Thread.sleep(100); return "Hi!"; });Observable.fromFuture(future) .subscribe(System.out::println); //prints: Hi!pool.shutdown();//6Observable.interval(100, TimeUnit.
Read now
Unlock full access