Java Streams

This tutorial talk about java streams. Streams are an update to the Java API that lets you manipulate collections of data in a declarative way (you express a query rather than code an ad-hoc implementation for it). You can consider stream as a fancy iterators over collection of data. The biggest advantage of using streams is that you can process the data in parallel without writing any multithreaded code.

Read More

Java 8 Date and Time

Java 8 Date Time API

With Java 8, a new Date-Time API is introduced to cover the following drawbacks of old date-time API.

Thread safety
Old java.util.Date is not thread safe, thus programmers have to deal with concurrency issue while using old API.
The new date-time API is immutable and does not have setter methods.

Design constraint
Default Date starts from 1900, month starts from 1, and day starts from 0, so no uniformity.
The old API had less direct methods for date operations. The new API provides numerous utility methods for such operations.

Simplified time zone handling
Developers had to write a lot of code to deal with timezone issues. The new API has been developed keeping domain-specific design in mind.

Read More