Java-Reactive Programming vs Event Listener

How is reactive programming different from calling a function in an event listener (mouse, key) because both are asynchronous event streams, so what causes Reactive over traditional event listeners to call?

+4
source share
1 answer

The event listener actually has only a subset of the functionality provided by RxJava , and what exactly is the problem that it is trying to solve:

But back to a few steps, it’s easier to understand that Observable , if you compare it with Iterator (push vs. pull).

Iterator.next() Observable.onNext() - / - .

Iterator.hasNext() Observable.onComplete() - , ( , EventListener).

, Observable.onError() , Iterator, next() remove(), , NoSuchElementException, UnsupportedOperationException IllegalStateException, , .

, , -/, . onError() - , , Observable .

, Reactive Java , . ( , , ..), , , , , (, -loops) callback-hell.

+4

All Articles