Learn about the difference between toMap and groupingBy when collecting a Java Stream into a Map.
Search Results for: any
Avoiding the IndexOutOfBoundsException When Using List.subList() in Java
In Java, subList() creates a sub-list from a larger list, but it can throw an exception if you give it invalid starting or ending positions. Learn how to avoid this error.
Mapping Enum to String Using MapStruct
A quick tutorial on using MapStruct to convert enums to strings.
How to Unit Test an ExecutorService Without Using Thread.sleep()
Learn how to unit test an ExecutorService instance without using the Thread.sleep() method.
Using MapStruct With Inheritance
Learn how to use the Mapstruct mappers with inherited Java bean classes.
Introduction to Java 22
Explore the latest Java release, Java 22, which is now in General Availability.
How to Test a Spring AOP Aspect
Learn how to conduct unit and integration tests on Spring AOP aspects.
Convert 2D Array Into 1D Array
Learn how to convert a two-dimensional array into a one-dimensional, which is commonly known as flattening.
Finding The Index of the Smallest Element in an Array
Learn how to find the index of the smallest element in an array.
Remove All Characters Before a Specific Character in Java
Explore several approaches to removing all characters before a specified character in a string.
Authenticate Using Social Login in Spring Authorization Server
Learn how to set up a Spring Boot maven project using the OAuth2 social login feature.
Handling Nulls in ArrayList.addAll()
Learn how to handle nulls in ArrayList.addAll().
Converting Float ArrayList to Primitive Array in Java
Learn how to convert an ArrayList of wrapper classes into an array of primitives.
How to Use Pair With Java PriorityQueue
Learn how to use Comparators with PriorityQueues and how to change the sorting order in such queues.
assertEquals() vs. assertSame() in JUnit
Compare the assertEquals() and assertSame() methods.
Compare the Numbers of Different Types
Learn how to compare primitives and numbers of different classes, such as Integers, Longs, and Floats.
Spring WebClient exchange() vs retrieve()
In this article, we explore the key methods from the WebClient interface, including retrieve(), exchangeToMono(), and exchangeToFlux().
Resolving Security Exception: java.security.UnrecoverableKeyException: Cannot Recover Key
Learn everything you need to know about java.security.UnrecoverableKeyException – what causes it and how to fix it.
Intro to Apache Commons Configuration Project
Apache Commons Configuration can be used to allow us to specify configuration parameters to be loaded at runtime by our application. We look at a few use cases and types of configuration files.
Get Nextval From Sequence With Spring JPA
Explore a few approaches for fetching the next value from a database sequence using Spring Data JPA.