In this post under RxJava, I will introduce you to Observable class’s two static methods “error” and “empty” methods. The error method creates an Observable instance that will send the error thrown to the Observer/Subscriber. The empty method creates as Observable instance that will not send any item, it just generate completion event to the…… Continue reading Observable error and empty method
Observable interval method
In this post under RxJava, I will explain with example how to use the static “interval” method of Observable class. This static method generates a stream of numbers of data type long with a time gap between generation of numbers. They are two overloaded versions of “interval” method, one that accepts an intial delay in…… Continue reading Observable interval method
Observable range method
In this post under RxJava, I will explain with example how to use the static “range” method of Observable class. This static method generates a stream of integers which fall within the specified range. The method takes two arguments1) The starting integer2) The count of sequential integers from the starting integer. Below is an example…… Continue reading Observable range method
Creating Observable from collections
In this post under RxJava, I will explain with example how to create Observable instances from collections. The Observable api provides methods to create Observable instance from Java Array, Collections, and Streams. Below is an example of it Example 1 import java.util.ArrayList; 2 import java.util.List; 3 4 import io.reactivex.rxjava3.core.Observable; 5 6 public class Example2 {…… Continue reading Creating Observable from collections
Observable (Observable’s just method) With Simple Example
In this post under RxJava, I will explain what is an Observable with an example. An Observable is a push based stream of data/events. In other words an Observable pushes items of type T directly to the observer or indirectly to an observer through a chain of operators. Types of Observable They are four types…… Continue reading Observable (Observable’s just method) With Simple Example
BiFunction’s andThen Example
In this post under Java, we will explain with an example the andThen method under BiFunction functional interface. BiFunction’s andThen method is used to chain a BiFunction interface implementation with one or more Function interface implementations. Lets consider an example. I have a list of employess with their salary and percent of bonus to apply…… Continue reading BiFunction’s andThen Example
javax.mail.Authenticator Example
In this post under Java Mail, I will explain the use of Authenticator abstract class with an example. Note: For this example and other examples in future we need to have1) Gmail account2) GMail SMTP server address3) Stop the antivirus software running on your local.4) Create an application password. The steps are mentioned in the…… Continue reading javax.mail.Authenticator Example
ConnectionListener Example
In this post under Java Mail, I will explain the use of ConnectionListener interface with an example. Note: For this example and other examples in future we need to have1) Gmail account2) GMail SMTP server address3) Stop the antivirus software running on your local.4) Create an application password. The steps are mentioned in the url…… Continue reading ConnectionListener Example
Chaining multiple ChunkListeners
In this post under Spring Batch, I will explain how to chain multiple ChunkListener together. For this example I will create two custom ChunkListener interface implementations named ‘CustomChunkListener1’ and ‘CustomChunkListener2’ as shown below CustomChunkListener1 package package35; import org.springframework.batch.core.ChunkListener; import org.springframework.batch.core.scope.context.ChunkContext; public class CustomChunkListener1 implements ChunkListener { @Override public void afterChunk(ChunkContext chunkContext) { System.out.println(“ChunkListener1 processing ended…… Continue reading Chaining multiple ChunkListeners
BiConsumer Example
In this post, I will show how to use BiConsumer functional interface with an example. BiConsumer functional interface is similar to Consumer functional interface. It takes an input, processes it and doesn’t return anything. The difference lies in the number of inputs taken by the BiConsumer functional interface. Consumer functional interface takes one input whereas…… Continue reading BiConsumer Example