What Happens When the JVM Runs Out of Memory to Allocate During Runtime?
1. Overview Defining an appropriate heap size for a JVM application is a crucial step. This might help our application with memory allocation and handling high loads. However, inefficient heap size,...
View ArticleRemove Characters From a String That Are in the Other String
1. Overview When we work with Java, we often encounter tasks that require precision and a collaborative effort between elements. Removing characters from a string based on their presence in another...
View ArticleCheck if List Contains at Least One Enum
1. Introduction In Java, еnumеrations (еnums) are a powerful and type-safe way to rеprеsеnt a fixеd sеt of constants. Moreover, when we’re working with collеctions like Lists, we might еncountеr...
View ArticleRemoving the Last Node in a Linked List
1. Overview Data structures are important parts of any programming language. Java provides most of them under the Collection<T> interface. Maps are also considered part of Java collections, but...
View ArticleConvert Null Value to a Default Value in Java
1. Overview In 1965, Tony Hoare introduced the concept of a null reference. Since then, countless hours have been spent reading the logs and trying to find the source of NullPointerExceptions. This...
View ArticleCheck if a Point Is Between Two Points Drawn on a Straight Line in Java
1. Overview When working with 2D geometry, one common problem is to determine whether a point lies between two other points on a straight line. In this quick tutorial, we’ll explore different...
View ArticleGet Specific Part From SOAP Message in Java
1. Overview We often employ REST or SOAP architectural approaches when designing API for data exchange. In the case of working with SOAP protocol, there may be situations when we need to extract some...
View ArticleGenerational ZGC in Java 21
1. Overview Java 21 debuted in September 2023, along with the introduction of the Generational ZGC. Building on the efficiency of the Z Garbage Collector, this update focuses on optimizing memory...
View ArticleImplementing Persistable-Only Entities in Spring Data JPA
1. Overview Spring JPA simplifies the interaction with a database and makes communication transparent. However, default Spring implementations sometimes need adjustments based on application...
View ArticleDifference Between a Future and a Promise in Java
1. Introduction Future and Promise are tools used to handle asynchronous tasks, allowing one to execute operations without waiting for each step to complete. Although they both serve the same purpose,...
View ArticleJava 8 Stream Operation on the Empty List
1. Introduction Java 8 brought a paradigm shift in the way we handle collections and data manipulation with the introduction of Streams. Stream APIs offer a concise and expressive way to perform...
View ArticleAdd Authorities as Custom Claims in JWT Access Tokens in Spring Authorization...
1. Overview Adding custom claims to JSON Web Token (JWT) access tokens can be crucial in many scenarios. Custom claims allow us to include additional information in the token payload. In this tutorial,...
View ArticleJava Weekly, Issue 524
1. Spring and Java >> Architecting with Java Persistence: Patterns and Strategies [infoq.com] Exploring different Java persistence patterns — plain driver-based approaches, active records and...
View ArticleReplace Non-Printable Unicode Characters in Java
1. Introduction Non-printable Unicode characters are control characters, style markers, and other invisible symbols that we can find in text but aren’t meant to show. Besides, these letters can cause...
View ArticleConverting Integer to BigDecimal in Java
1. Overview BigDecimal is designed to work with large floating point numbers. It solves the problem with floating point arithmetic and provides a way to control the precision. Additionally, it has...
View ArticleCall a Method on Each Element of a List in Java
1. Overview When we work with Java, whether we’re working with pre-Java 8 code or embracing the functional elegance of the Stream API in Java 8 and beyond, calling a method on each element of a list is...
View ArticleCreate Kubernetes Operators with the Java Operator SDK
1. Introduction In this tutorial, we’ll present the concept of Kubernetes operators and how we can implement them using the Java Operator SDK. To illustrate this, we’ll implement an operator that...
View ArticleConverting Integer to BigDecimal in Java
1. Overview BigDecimal is designed to work with large floating point numbers. It solves the problem with floating point arithmetic and provides a way to control the precision. Additionally, it has...
View ArticleConvert Joda-Time DateTime to Date and Vice Versa
1. Introduction Joda-Time is a very popular Java library concerning date and time manipulation. It gives a much more intuitive and flexible API than that usually offered by the standard DateTime class....
View ArticleSolving the ParameterResolutionException in JUnit 5
1. Overview JUnit 5 introduced some powerful features, including support for parameterized testing. Writing parameterized tests can save a lot of time, and in many cases, they can be enabled with a...
View Article