The story of RxJava suffering from NoSuchElementException

If flatMapSingle () is used when connecting Flowable or Maybe to Single, NoSuchElementException may occur.

When connecting a Single to a stream where Complete may flow, if Complete actually flows, it cannot be processed by Single and an exception will fly, and the application will die as it is. RxJava does a good job of connecting Flowable to Single normally. In the first place, I can't connect Single to Completable. However, flatMapSingle () will connect without any problem, so you need to use flatMapSingleElement () instead. There are no compilation errors, no error logs, no IDE warnings, but we have to be aware that we're doing something weird.

Digression

If you write a process that connects asynchronous processes with a flatMap and connects them, you will feel that Rx is a monad of asynchronous processes, and there is a merit that you will feel that you fully understand the functional type. On the contrary, by using flatMap or andThen, I wonder if it will be possible to understand monads using that as a clue ...

Recommended Posts

The story of RxJava suffering from NoSuchElementException
The story of migrating from Paperclip to Active Storage
The story of raising Spring Boot from 1.5 series to 2.1 series part2
[Java version] The story of serialization
The story of @ViewScoped consuming memory
[Challenge CircleCI from 0] Learn the basics of CircleCI
The story of updating SonarQube's Docker Container
The story of AppClip support in Anyca
Ruby from the perspective of other languages
The story of writing Java in Emacs
Find the difference from a multiple of 10
The story of switching from Amazon RDS for MySQL to Amazon Aurora Serverless
The story of acquiring Java Silver in two months from completely inexperienced.
Has the content of useBodyEncodingForURI changed from Tomcat8?
The story of low-level string comparison in Java
The story of making ordinary Othello in Java
The story of learning Java in the first programming
The story of making the existing Dockerfile GPU compatible
The story of tuning android apps with libGDX
The story of adding the latest Node.js to DockerFile
The story of initializing Money :: Currency when testing
ArrayList and the role of the interface seen from List
Volume 3 types of Docker Compose considered from the purpose
How to write Scala from the perspective of Java
About the usefulness of monads from an object-oriented perspective
The story of making a reverse proxy with ProxyServlet
The story of an Illegal State Exception in Jetty.
Extract a specific element from the list of objects
A record of studying the Spring Framework from scratch
The story of making Dr. Oakid using LINE BOT
The story of making dto, dao-like with java, sqlite
The world of clara-rules (2)
The story of migrating a stray batch without an owner from EC2 to a Docker environment
Judgment of the calendar
The world of clara-rules (4)
The world of clara-rules (3)
The world of clara-rules (5)
The idea of quicksort
The idea of jQuery
The story of managing session information by introducing gem Redis
Get to the abbreviations from 5 examples of iterating Java lists
20190803_Java & k8s on Azure The story of going to the festival
How to get the longest information from Twitter as of 12/12/2016
From the habit of creating Value Objects for object-oriented understanding
[Summary of technical books] Summary of reading "Learn Docker from the basics"
Aggregate the number of people every 10 years from List <Person>
The story of pushing Java to Heroku using the BitBucket pipeline
[Java] Delete the specified number of characters from the end of StringBuilder
The story of dieting the container of the Elixir application as much as possible
[Apache Tomcat] The story of using Apache OpenWebBeans to enable CDI
27-year-old story of becoming a development engineer from inexperienced programming
The story of setting up an Oracle V $ -like thing from 0 on PostgreSQL: 12 of the official Docker image