From Java 9 onwards, we can declare private methods in interface. In this post I will show with an example of how to do it. Private methods in interface are useful if you have logic shared by more than one default interface methods. We can put the shared logic in the private method. Below is…… Continue reading Private Interface Methods
Month: August 2020
BiFunction Example
In this post, I will show how to use BiFunction functional interface with an example. BiFunction functional interface is similar to Function functional interface. It takes an input and produces an output. The difference lies in the number of inputs taken by the BiFunction functional interface. Function functional interface takes one input and produced one…… Continue reading BiFunction Example
Chaining multiple ItemProcessorListener
In this post under Spring Batch, I will explain with example how to chain multiple ItemProcessorListeners. For our example we create two ItemProcessorListener as shown below CustomItemProcessListener1 package package34; import org.springframework.batch.core.ItemProcessListener; public class CustomItemProcessListener1 implements ItemProcessListener<Employee, Employee> { @Override public void afterProcess(Employee employee1, Employee employee2) { System.out.println(“CustomItemProcessListener1: Item processing completed”); } @Override public void beforeProcess(Employee…… Continue reading Chaining multiple ItemProcessorListener
Sending Email Using SMTP (Approach 2)
In this post under Java Mail. I will show with an example how to send email using Java Mail api and SMTP protocol. Note: For this example and other examples in future we need to have 1) Gmail account 2) GMail SMTP server address 3) Stop the antivirus software running on your local. 4) Create…… Continue reading Sending Email Using SMTP (Approach 2)