Java 8

Convert Milliseconds into Years, Months, Weeks, Days, Hours, Minutes, Seconds in Java

Introduction This example shows you how to convert milliseconds into years, months, weeks, days, hours, minutes, seconds in Java. Sometimes we need to convert the milliseconds into years or months or weeks or days or hours or minutes or seconds. For example, when you want to check the exact time taken by a program to […]

Convert Milliseconds into Days, Hours, Minutes, Seconds in Java

Introduction This example shows you hot to convert milliseconds into days, hours, minutes, seconds in Java. Sometimes we need to convert the milliseconds into days or hours or minutes or seconds. Typically when you want to check the exact time taken to execute a program then you may need to calculate the time. So in […]

Collect and Convert Objects using Lambda Expression in Java 8

Introduction In this tutorial, I will show you how you are going to collect and convert objects using lambda expression in Java 8 stream API. We will collect objects and map to another custom objects using Java 8 stream API with the help of Lambda Expression. Suppose you have entity classes generated from your database […]

CompletableFuture in Java

A Future represents the pending result of an asynchronous computation. It offers a method — get — that returns the result of the computation when it’s done. The problem is that a call to get is blocking until the computation is done. This is quite restrictive and can quickly make the asynchronous computation pointless. CompletableFuture<T> […]

Java 8 Date and Time

The Date-Time package, java.time, introduced in the Java SE 8 release, provides a comprehensive model for date and time. Why do we need for a new Date and Time library ? Non thread-safe The existing classes (such as java.util.Date and SimpleDateFormatter) aren’t thread-safe, leading to potential concurrency issues for users — not something the average […]

Java 8 Stream API

This tutorial will explain about Java’s new API called stream, which is introduced in Java 8 and included in package java.util.stream. The stream API supports functional-style operations on collection of elements or stream of elements in a collection. For example, you only want to print even numbers from a list of numbers, then you can […]

Scroll to top