BASIC / NOTES</>↗Basic02 Nov 2025
Java 25 is the latest version of the Java Development Kit (JDK), packed with performance improvements and new features. In this guide, you’ll learn how to install Java 25 on your system and write your first “Hello, World!” program using the new classless main method feature. Tip: Java 25 introduces the ability to write simple […]
STREAM API / NOTES</>↗Stream API01 Nov 2025
To parallelize a stream in Java and improve performance, you can use the parallelStream method or convert a normal stream into a parallel stream using the Stream.parallel() method. Parallel streams allow data to be processed on multiple threads, leveraging multicore processors. Here’s a detailed explanation and examples: 1. Using parallelStream() You can use the parallelStream() […]
STREAM API / NOTES</>↗Stream API31 Oct 2025
The Stream.peek method in Java’s Stream API is an invaluable utility for debugging your stream pipeline. It provides a way to inspect (or “peek at”) the elements of your stream during the processing without modifying them. This is typically used for logging or debugging purposes. Here’s how Stream.peek works and how you can use it […]
UTIL PACKAGE / NOTES</>↗Util Package30 Oct 2025
In Java, you can safely convert a List to a Map using Collectors.toMap by ensuring that duplicate keys or null values are handled appropriately. Here’s how you can achieve this: Safe Conversion Approach: When working with Collectors.toMap, it’s important to keep the following in mind: Handle Key Collisions: If multiple elements map to the same […]
UTIL PACKAGE / NOTES</>↗Util Package29 Oct 2025
To use Map.Entry.comparingByValue for sorting a Map, you can leverage Java Streams, which provide an efficient way to process and sort collection data. Here’s how the process works: Retrieve the entrySet of the Map: This gives a set of Map.Entry objects that you can operate on with a stream. Sort using Map.Entry.comparingByValue: Use Stream.sorted() along […]
UTIL PACKAGE / NOTES</>↗Util Package29 Oct 2025
In Java’s Stream API, Collectors.mapping is a collector that applies a mapping function to the input elements before collecting the results. It is often used as part of nested transformations, where one wants to apply a specific transformation on elements that are part of a more complex collector, such as a groupingBy. Syntax of Collectors.mapping […]