Convert String to long or Long in Java
1. Overview In this tutorial, we’ll explore how to convert a String to a long primitive or Long object. Let’s suppose we have a String whose value reflects a number just outside the range of a signed...
View ArticleJava’s String.length() and String.getBytes().length
1. Overview When we work in Java, manipulating strings is one of the fundamental skills. So, understanding string-related methods is crucial for writing efficient and error-free code. Two commonly used...
View ArticleSending Data to a Specific Partition in Kafka
1. Introduction Apache Kafka is a distributed streaming platform that excels in handling massive real-time data streams. Kafka organizes data into topics and further divides topics into partitions....
View ArticleJava Weekly, Issue 523
1. Spring and Java >> Using AI to Create JFR Event Descriptions [foojay.io] Having fun with JFR events and GPT: generating descriptions for different JFR events via GenAI >> Quarkus...
View ArticleFind Missing Number From a Given Array in Java
1. Overview Finding the missing number from a specified range within an array in Java can be useful in various scenarios, such as data validation, ensuring completeness, or identifying gaps in a...
View ArticleRemove Null Objects in JSON Response When Using Spring and Jackson
1. Overview JSON is a de-facto standard for RESTful applications. Spring uses the Jackson library to convert objects into and from JSON seamlessly. However, sometimes, we want to customize the...
View ArticleDifference Between Xmx and MaxRAM JVM Parameters
1. Overview Heap size is an essential parameter of Java applications. It directly affects how much memory we can use and indirectly impacts the applications’ performance. For example, the usage of...
View ArticleIntroduction to Spring AI
1. Overview Spring Framework officially enabled the power of AI generative prompts with the Spring AI project. This article aims to provide a robust introduction to the generative AI integration in the...
View ArticleCreating Reactive APIs With Micronaut and MongoDB
1. Overview In this tutorial, we’ll explore how to create reactive REST APIs with Micronaut and MongoDB. Micronaut is a framework for constructing microservices and serverless applications on the Java...
View ArticleRead Multiple Messages with Apache Kafka
1. Overview In this tutorial, we’ll explore how the Kafka Consumer retrieves messages from the broker. We’ll learn the configurable properties that can directly impact how many messages the Kafka...
View ArticleWhat 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 Article