Immutable vs Unmodifiable Collection in Java
1. Introduction In this tutorial, we’re looking into two flavors of collections in addition to the common Collection classes we have in Java. As we know, we have three core collection classes: Map,...
View ArticleOpening HTML File Using Java
1. Introduction In various Java applications, HTML files are often needed to be programmatically opened and displayed. Java provides several methods to accomplish this task, whether it’s for generating...
View ArticleStatements Before super() in Java
1. Introduction In Java programming, we use the super() keyword to invoke the superclass constructor. However, there are specific rules regarding the placement of statements before the super() call...
View ArticleDisable @Cacheable in Spring Boot
1. Introduction Caching is an effective strategy to improve performance by avoiding repeated execution of logic when the execution result hasn’t changed (effectively the same) for a known period....
View ArticleQuerying JSONB Columns Using Spring Data JPA
1. Introduction Spring Data JPA provides a powerful abstraction layer for interacting with relational databases. However, traditional relational tables might not be ideal for storing complex,...
View ArticleHow to Check Number Perfection
1. Introduction A perfect number is a special type of positive integer that holds a unique property as it is equal to the sum of its proper divisors, excluding the number itself. One of the most...
View ArticleChecking Which Java Version Is Running in Eclipse
1. Overview When working with Java in the Eclipse IDE, ensuring the correct Java version is essential for compiling and executing code accurately. Eclipse simplifies this process by providing...
View ArticleContinue With Transaction After Exception in JPA
1. Overview The transaction mechanism in JPA is a powerful tool that ensures atomicity and data integrity by either committing all changes or rolling them back in case of an exception. However, there...
View ArticleHow to Test Spring Application Events
1. Overview In this tutorial, we’ll discuss testing code that uses Spring application events. We’ll start by manually creating test utilities that help us publish and collect application events for...
View ArticleFix the PSQLException: “FATAL: sorry, too many clients already”
1. Overview In this tutorial, let’s discuss the PostgreSQL exception, FATAL: sorry, too many clients already. Generally, the PostgreSQL server throws this error when it cannot accept a connection...
View ArticleConvert a Phone Number in Words to Number with Java
1. Overview We may wish to process a telephone number expressed as text. Perhaps we have received a telephone number via a speech-to-text interface. In this tutorial, we’ll look at an algorithm for...
View ArticleThe Difference Between Throwing an Exception and Mono.error() in Spring Webflux
1. Overview Error handling is a critical aspect of reactive programming with Spring WebFlux. Developers usually rely on two primary methods for error handling: throwing exceptions or using the...
View ArticleIntroduction to Light-4J
1. Introduction Traditional frameworks, while robust, often introduced complexities that challenged agility. Modern development demands frameworks that aren’t just powerful but nimble. Lightweight...
View ArticleHow to Scale a Bufferedimage in Java?
1. Introduction In this tutorial, we’ll go over how to rescale an image using basic Java APIs. We’ll show how to load and save the image from/to a file and explain some technical aspects of the...
View ArticleJava Weekly, Issue 537
1. Spring and Java >> Expressive REST Resources with Java Records and Jakarta REST [blog.payara.fish] Java Records As DTOs: concise, immutable, readable, expressive, and more secure. Yeah....
View ArticleRefresh and Fetch an Entity After Save in JPA
1. Introduction Java Persistence API (JPA) acts as a bridge between Java objects and relational databases, allowing us to persist and retrieve data seamlessly. In this tutorial, we’ll explore various...
View ArticleCommit Offsets in Kafka
1. Overview In Kafka, consumers read messages from partitions. While reading messages, there are some concerns to consider, like determining which messages to read from the partitions or, preventing...
View ArticleFind the Largest Number Possible After Removing k Digits of a Number
1. Overview In this tutorial, we’ll see different algorithms allowing us to find the largest number possible after removing the k digits of a number. First, we’ll explain the problem. Then, we’ll see...
View ArticleCalculate Percentiles in Java
1. Overview When it comes to analyzing data in Java, calculating percentiles is a fundamental task in understanding the statistical distribution and characteristics of a numeric dataset. In this...
View ArticleAdding Elements to a Collection During Iteration
1. Introduction Iterating over a List is a common operation in Java, but adding elements to it while iterating requires careful consideration to avoid exceptions and ensure the correctness of the code....
View Article