Merge Streams In Java

In this tutorial, I am showing how to merge multiple streams in java using different ways.

Note: Stream.concat(stream1,stream2) method is useful when you have 2 streams and if you have more than 2 streams, you can use Stream.of(stream1, stream2, stream3, stream4) method.



Getting Mime type in Java

In this tutorial, I am showing how to get mime type of a file in java using Java 7 Files and URLConnection class.

You can select right one from the below listed, which suits your needs.



Java Iterating Over Enum values

In this tutorial, I am showing about enums iteration using different ways like forEach, stream and for loop.

An Java enum is a special data type which helps you to assign set of predefined constants to a variable


Java 8 findFirst() vs findAny()

In this tutorial, I am showing the differences between findFirst() and findAny() methods of java 8 stream api and where it can be used.

Note: As per the stream documentation “Streams may or may not have a defined encounter order. Whether or not a stream has an encounter order depends on the source and the intermediate operations. Certain stream sources (such as List or arrays) are intrinsically ordered, whereas others (such as HashSet) are not”.

Send Email Using Java

In this tutorial, I am showing how to send an email using JavaMail Api. Sending email is a required use case for every project.

Here I am using gmail host( smtp.gmail.com) and gmail username and password for authentication. For a bigger projects, you have to use paid mail service provider and they will provide the required information like host and port parameters.

Here I am explaining following topics with complete examples

a) Sending plain text Email with JavaMail API

b) Sending HTML email with JavaMail API

c) Sending email attachment with JavaMail API

Read CSV File Using Java Scanner Class

Here I am demonstrating how to read / parse CSV file using java scanner class.

For example my csv file (user.csv) looks like below.

Rockey,22,India
Bill,23,US
Sonia,23,Germany


Now I am creating java class for mapping the above fields in csv file.


Create Gantt Chart Using JFreeChart

Create Gantt Chart Using JFreeChart explains about creating a simple gantt chart using JFreechart API

A Gantt chart is a type of bar chart that illustrates a project schedule, named after their inventor, Henry Gantt (1861–1919), who designed such a chart around the years 1910–1915. Modern Gantt charts also show the dependency relationships between activities and current schedule status.

Reference -> https://en.wikipedia.org/wiki/Gantt_chart

How To Create Gantt Chart Using JFreeChart library?

Create Scatter Chart Using JFreeChart

Create Scatter Chart Using JFreeChart explains about creating a simple scatter chart using JFreechart API

A scatter plot (also called a scatterplot, scatter graph, scatter chart, scattergram, or scatter diagram) is a type of plot or mathematical diagram using Cartesian coordinates to display values for typically two variables for a set of data. If the points are color-coded, one additional variable can be displayed. The data are displayed as a collection of points, each having the value of one variable determining the position on the horizontal axis and the value of the other variable determining the position on the vertical axis.

Reference -> https://en.wikipedia.org/wiki/Scatter_plot

How To Create Scatter Chart Using JFreeChart library?