Java UUID Generator Example

Last Updated:

Learn what is UUID and it’s versions and variants. Learn to generate UUID in Java using UUID.randomUUID() API. Also learn to generate version 5 UUID …

Pairs in Java

Last Updated:

Learn to work with key value pairs in Java using Pair classes e.g. javafx.util.Pair, ImmutablePair, MmutablePair (common langs) and io.vavr.Tuple2 class. Read More : Tuples …

Java 8 – Parse string to date-time in UTC

Learn to parse a given date time string to instance e.g. ZonedDateTime or OffsetDateTime classes, using DateTimeFormatter class in Java 8. 1. Instant, OffsetDateTime and …

Java 8 ResolverStyle.STRICT

Last Updated:

Learn to parse date and time strings into instances of LocalDate and LocalDateTime using strict style using ResolverStyle.STRICT parameter with DateTimeFormatter instance. 1. ResolverStyle – …

Java DelayQueue

DelayQueue class is an unbounded blocking queue of delayed elements, in which an element can only be taken when its delay has expired.

ExecutorService – Cancel a task in executor

Learn to cancel a task submitted to an executor which is still has to be executed and has not been completed yet using cancel() method of Future object which allows you to make the cancellation operation.

ExecutorService invokeAll()

Learn to run multiple Callable tasks with ExecutorService.invokeAll(tasks) API and processing all the results returned from tasks in form of Future class instances in this ExecutorService Callable example.

ExecutorService invokeAny()

Last Updated:

Learn to use ExecutorService invokeAny() method where we execute multiple tasks at same time, but we make a decision asap any one of tasks is completed.

Callable Future Example

Last Updated:

Learn to execute callable tasks (which return a result of type Future after execution) using ExecutorService implementations in this simple Callable Future example.

Executor RejectedExecutionHandler

Learn to handle tasks which are submitted to Executor and are rejected because the executor has been shutdown for any reason using RejectedExecutionHandler. 1. When …

ExecutorService in Java

Last Updated:

Learn to use Java ExecutorService to execute a Runnable or Callable class in an asynchronous way. Also learn the various best practices to utilize it in most efficient manner in any Java application.

Compare LocalDateTime instances

Last Updated:

Learn to compare two LocalDateTime instances to find out which date represents an older timestamp in comparison to other timestamp. LocalDateTime class is part of java.time package added in Java 8.

Compare LocalDate instances

Last Updated:

Learn to compare two LocalDate instances to find out which date represents an older date in comparison to second date. LocalDate class is part of java.time package added in Java 8.

A Guide to AtomicInteger in Java

Last Updated:

The AtomicInteger class protects an underlying int value by providing methods that perform atomic operations on the value. It shall not be used as a replacement for an Integer class.

Format date/timestamp in 12 hours pattern

Last Updated:

Learn to format date and time in either 12 hours pattern. The formatted date string will have the AM/PM information as applicable to the timestamp.

LocalDate format() API

Last Updated:

Java 8 examples to format LocalDate to String in default patterns as well as custom date patterns. 1. Default pattern [yyyy-MM-dd] If we use the …


A blog about Java and its related technologies, the best practices, algorithms, interview questions, scripting languages, and Python.