SlideShare a Scribd company logo
ReactiveX
ReactiveX
The best of functional programming and design
patterns !
Agenda
● Functional Programming (Java 8)
○ Getting Started
○ Examples
● Observer Pattern
○ Introduction
○ Real life example
○ UML
● ReactiveX
○ Introduction
○ Getting Started
○ Example
○ Operators
Getting Started with Functional Programming
(Java 8)
Functional Programming
● Introduction
● Streams and lambda expressions
● Stream operations
⚪ Filter Stream
⚪ Sort Stream
⚪ Map Stream
⚪ Match Stream
⚪ Stream count
● Optionals
● Reduce Stream
● Parallel vs Sequential streams
Functional Programming
● Introduction
● Streams and lambda expressions
● Stream operations
⚪ Filter Stream
⚪ Sort Stream
⚪ Map Stream
⚪ Match Stream
⚪ Stream count
● Optionals
● Reduce Stream
● Parallel vs Sequential streams
Introduction
● It is a declarative programming paradigm, which means programming is
done with expressions.
● Functional code, the output value of a function depends only on the
arguments that are input to the function.
Functional Programming
● Introduction
● Streams and lambda expressions
● Stream operations
⚪ Filter Stream
⚪ Sort Stream
⚪ Map Stream
⚪ Match Stream
⚪ Stream count
● Optionals
● Reduce Stream
● Parallel vs Sequential streams
Lambda Expressions & Streams
Check Prime Numbers
Stream From Collection
Functional Programming
● Introduction
● Streams and lambda expressions
● Stream operations
⚪ Filter Stream
⚪ Sort Stream
⚪ Map Stream
⚪ Match Stream
⚪ Stream count
● Optionals
● Reduce Stream
● Parallel vs Sequential streams
Filter Stream
Functional Programming
● Introduction
● Streams and lambda expressions
● Stream operations
⚪ Filter Stream
⚪ Sort Stream
⚪ Map Stream
⚪ Match Stream
⚪ Stream count
● Optionals
● Reduce Stream
● Parallel vs Sequential streams
Sort Stream
- The ordering of stringCollection is untouched.
Functional programming
● Introduction
● Streams and lambda expressions
● Stream operations
⚪ Filter Stream
⚪ Sort Stream
⚪ Map Stream
⚪ Match Stream
⚪ Stream count
● Optionals
● Reduce Stream
● Parallel vs Sequential streams
Map Stream
Functional programming
● Introduction
● Streams and lambda expressions
● Stream operations
⚪ Filter Stream
⚪ Sort Stream
⚪ Map Stream
⚪ Match Stream
⚪ Stream count
● Optionals
● Reduce Stream
● Parallel vs Sequential streams
Match Stream
Match Stream
Match Stream
Functional programming
● Introduction
● Streams and lambda expressions
● Stream operations
⚪ Filter Stream
⚪ Sort Stream
⚪ Map Stream
⚪ Match Stream
⚪ Stream count
● Optionals
● Reduce Stream
● Parallel vs Sequential streams
Count
Functional programming
● Introduction
● Streams and lambda expressions
● Stream operations
⚪ Filter Stream
⚪ Sort Stream
⚪ Map Stream
⚪ Match Stream
⚪ Stream count
● Optionals
● Reduce Stream
● Parallel vs Sequential streams
Optional in Java 8
Functional programming
● Introduction
● Streams and lambda expressions
● Stream operations
⚪ Filter Stream
⚪ Sort Stream
⚪ Map Stream
⚪ Match Stream
⚪ Stream count
● Optionals
● Reduce Stream
● Parallel vs Sequential streams
Reduce Stream
Functional programming
● Introduction
● Streams and lambda expressions
● Stream operations
⚪ Filter Stream
⚪ Sort Stream
⚪ Map Stream
⚪ Match Stream
⚪ Stream count
● Optionals
● Reduce Stream
● Parallel vs Sequential streams
Parallel vs Sequential Streams
Sequential stream
Parallel stream
Agenda
● Functional Programming (java 8)
○ Getting Started
○ Examples
● Observer Pattern
○ Introduction
○ Real life example
○ UML
● ReactiveX
○ Introduction
○ Getting Started
○ Example
○ Operators
Observer pattern
Introduction
● Defines a “one-to-many” dependency between objects so that when one
object changes state, all its dependents are notified and updated.
● Subject: the object which will frequently change its state and upon
which other objects depend.
● Observer: the object which depends on a subject and updates according
to its subject’s state.
Real Life Example
UML
Agenda
● Functional Programming (java 8)
○ Getting Started
○ Examples
● Observer Pattern
○ Introduction
○ Real life example
○ UML
● ReactiveX
○ Introduction
○ Getting Started
○ Example
○ Operators
ReactiveX
ReactiveX is a combination of the best ideas from
the Observer pattern, the Iterator pattern, and functional programming
Introduction
● Reactive programming is a programming paradigm
oriented around data flows and propagation of change.
● Let:
a = b + c
what about if b or c has been changed?!
Introduction
● Functional Reactive programming (FRP) is a style of
programming based on two keys ideas: continuous
time-varying behaviors, and event based reactively.
● Popularized by Erik Meijer when he created the Rx
library for .Net while at Microsoft.
Reactive Programming
Reactive programming is programming with asynchronous data streams.
What Are Reactive Extensions?
● It’s a library that allows you to use FRP at many
programming languages.
● Allows you to represent asynchronous data streams
with “Observables”.
● And Parametrize the concurrency in those
asynchronous data streams using “Schedulers”
Rx Family
● C#: Rx.NET
● Javascript: RxJS
● RxJava (Java, Scala, Groovy, Clojure, Kotlin).
● Ruby: Rx.rb
● Python: RxPY
● More at http://reactivex.io/
Why Functional Reactive Programming?
● Writing concurrent programs correctly is difficult.
● You can transform & compose asynchronous operations.
● High-level abstraction.
● Standard error handling.
Push vs Pull
Observables and Observer
● In ReactiveX an Observer subscribes to an Observable.
● Then That Observer reacts to whatever item or sequence of items the
Observable emits.
● This patterns facilitate concurrent operations because it does not need
to block while waiting for the observable.
Observer onNext, onCompleted, onError
An Observer implements a subset of the following methods:
● onNext: We call this method whenever the Observable emits an item.
● onError: Call this method to indicate the the observable has failed and
will not make further calls to onNext or onCompleted.
● onCompleted: Call this method after you have called onNext for the final
time and if we have not encountered any errors.
The “Subscribe” method
RxJava
● It’s a JVM implementation of Reactive Extensions.
● Started at Netflix but now Open Sourced.
● Supports Java 6+ & Android 2.3+.
● Java 8 lambda support.
Creating an Observable
Creating an Observable
Creating an Observable
Transforming Observables
Filtering Observables
Filtering Observables
● first()
● distinct()
● take()
● skip()
● elementAt()
● sample()
● more …
● More at
https://github.com/ReactiveX/RxJava/wiki/Filtering-Observables
Aggregate Operators
Combining Observables
Combining Observables
Thanks !

More Related Content

PDF
ReactiveX-SEA
PDF
Reactive Programming
PPTX
Intro to RxJS
PPTX
RxJS vs RxJava: Intro
PPTX
Kotlin REST & GraphQL API
PDF
GraphQL (Graphene-Django)
PDF
Sprint Boot & Kotlin - Meetup.pdf
PDF
Javantura v4 - Java or Scala – Web development with Playframework 2.5.x - Kre...
ReactiveX-SEA
Reactive Programming
Intro to RxJS
RxJS vs RxJava: Intro
Kotlin REST & GraphQL API
GraphQL (Graphene-Django)
Sprint Boot & Kotlin - Meetup.pdf
Javantura v4 - Java or Scala – Web development with Playframework 2.5.x - Kre...

What's hot (20)

PDF
Implementing GraphQL API in Elixir – Victor Deryagin
PDF
Reactive in Android and Beyond Rx
PDF
River Trail: A Path to Parallelism in JavaScript
PDF
A Tool For Big Data Analysis using Apache Spark
PDF
Javantura v4 - Java and lambdas and streams - are they better than for loops ...
PDF
LINEデリマでのElasticsearchの運用と監視の話
PDF
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
PDF
Dynamic pricing of Lyft rides using streaming
PDF
Overcome a Frontier
PDF
Running Through Typescript
PDF
Productionalizing a spark application
ODP
Python simillar image search
PPTX
Python Streaming Pipelines with Beam on Flink
PPTX
Capstone1 13주차 발표 (morph chart) 수정
PDF
From rest api to graph ql a 10 year journey
PDF
Adopting language server for apache camel feedback from a java/Eclipse plugi...
PDF
Interactive workflow management using Azkaban
PDF
java8-patterns
PPTX
Ruby to Scala in 9 weeks
PPTX
Going Reactive with Spring 5
Implementing GraphQL API in Elixir – Victor Deryagin
Reactive in Android and Beyond Rx
River Trail: A Path to Parallelism in JavaScript
A Tool For Big Data Analysis using Apache Spark
Javantura v4 - Java and lambdas and streams - are they better than for loops ...
LINEデリマでのElasticsearchの運用と監視の話
All About GRAND Stack: GraphQL, React, Apollo, and Neo4j (Mark Needham) - Gre...
Dynamic pricing of Lyft rides using streaming
Overcome a Frontier
Running Through Typescript
Productionalizing a spark application
Python simillar image search
Python Streaming Pipelines with Beam on Flink
Capstone1 13주차 발표 (morph chart) 수정
From rest api to graph ql a 10 year journey
Adopting language server for apache camel feedback from a java/Eclipse plugi...
Interactive workflow management using Azkaban
java8-patterns
Ruby to Scala in 9 weeks
Going Reactive with Spring 5
Ad

Similar to ReactiveX (20)

PDF
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo Mazzaferro
PDF
FlinkML: Large Scale Machine Learning with Apache Flink
PPTX
PDF
Java SE 8 library design
PDF
Modern APIs with GraphQL
PDF
Reactive programming using rx java & akka actors - pdx-scala - june 2014
PDF
Getting Started with Spring for GraphQL
PDF
FlinkML - Big data application meetup
PDF
Reactive systems
PDF
Anatomy of Data Frame API : A deep dive into Spark Data Frame API
PPTX
React native introduction (Mobile Warsaw)
PDF
Custom Pregel Algorithms in ArangoDB
PDF
Lambda.pdf
PPTX
Solve it Differently with Reactive Programming
PDF
GraphQL is actually rest
PPTX
Enhancements in Java 9 Streams
PPTX
Java 8 streams
PDF
Compiler Design
PPTX
Reactive Programming on Android - RxAndroid - RxJava
PDF
Java Lambda internals with invoke dynamic
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo Mazzaferro
FlinkML: Large Scale Machine Learning with Apache Flink
Java SE 8 library design
Modern APIs with GraphQL
Reactive programming using rx java & akka actors - pdx-scala - june 2014
Getting Started with Spring for GraphQL
FlinkML - Big data application meetup
Reactive systems
Anatomy of Data Frame API : A deep dive into Spark Data Frame API
React native introduction (Mobile Warsaw)
Custom Pregel Algorithms in ArangoDB
Lambda.pdf
Solve it Differently with Reactive Programming
GraphQL is actually rest
Enhancements in Java 9 Streams
Java 8 streams
Compiler Design
Reactive Programming on Android - RxAndroid - RxJava
Java Lambda internals with invoke dynamic
Ad

More from BADR (15)

PDF
Sunspot - The Ruby Way into Solr
PDF
Docker up and Running For Web Developers
PDF
Vue.js
PDF
There and Back Again - A Tale of Programming Languages
PDF
Take Pride in Your Code - Test-Driven Development
PDF
Single Responsibility Principle
PDF
NoSQL Databases
PDF
Explicit Semantic Analysis
PDF
Getting some Git
PDF
Algorithms - A Sneak Peek
PDF
Android from A to Z
PDF
Apache Hadoop - Big Data Engineering
PDF
MySQL Indexing
PDF
Duckville - The Strategy Design Pattern
PDF
The Perks and Perils of the Singleton Design Pattern
Sunspot - The Ruby Way into Solr
Docker up and Running For Web Developers
Vue.js
There and Back Again - A Tale of Programming Languages
Take Pride in Your Code - Test-Driven Development
Single Responsibility Principle
NoSQL Databases
Explicit Semantic Analysis
Getting some Git
Algorithms - A Sneak Peek
Android from A to Z
Apache Hadoop - Big Data Engineering
MySQL Indexing
Duckville - The Strategy Design Pattern
The Perks and Perils of the Singleton Design Pattern

Recently uploaded (20)

PDF
AutoCAD Professional Crack 2025 With License Key
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Patient Appointment Booking in Odoo with online payment
PDF
Nekopoi APK 2025 free lastest update
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Autodesk AutoCAD Crack Free Download 2025
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
17 Powerful Integrations Your Next-Gen MLM Software Needs
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Transform Your Business with a Software ERP System
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Oracle Fusion HCM Cloud Demo for Beginners
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
AutoCAD Professional Crack 2025 With License Key
Digital Systems & Binary Numbers (comprehensive )
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Design an Analysis of Algorithms I-SECS-1021-03
Patient Appointment Booking in Odoo with online payment
Nekopoi APK 2025 free lastest update
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Computer Software and OS of computer science of grade 11.pptx
Reimagine Home Health with the Power of Agentic AI​
Autodesk AutoCAD Crack Free Download 2025
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Wondershare Filmora 15 Crack With Activation Key [2025
17 Powerful Integrations Your Next-Gen MLM Software Needs
Navsoft: AI-Powered Business Solutions & Custom Software Development
Transform Your Business with a Software ERP System
Why Generative AI is the Future of Content, Code & Creativity?
Design an Analysis of Algorithms II-SECS-1021-03
Operating system designcfffgfgggggggvggggggggg
Oracle Fusion HCM Cloud Demo for Beginners
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf

ReactiveX