Guide to ExecutorService vs. CompletableFuture
1. Introduction In this tutorial, we’ll explore two important Java classes for handling tasks that need to run concurrently: ExecutorService and CompletableFuture. We’ll learn their functionalities and...
View ArticleJava Weekly, Issue 534 – All About Java 22
1. Spring and Java >> The Arrival of Java 22! [inside.java] This week is dominated by the newest Java release—amazing work! Also, one of our editors, Grzegorz, was mentioned with his library!...
View ArticleFinding the Peak Elements of a List
1. Introduction Peak elements within an array are important for numerous algorithms, offering valuable insights into the dataset’s characteristics. In this tutorial, let’s explore the concept of peak...
View ArticleHow to Convert Excel to JSON in Java
1. Introduction Converting Excel data to JSON format is common in many Java applications, especially when dealing with data interchange between different systems. In this tutorial, we’ll explore two...
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 ArticleInvalid Characters in XML
1. Overview XML (eXtensible Markup Language) is one of the most widely used formats for storing and transporting data across various platforms and applications. However, despite its robustness, XML is...
View ArticleCreating a Spring Security Key for Signing a JWT Token
1. Overview JSON Web Tokens (JWT) is the de facto standard for securing a stateless application. The Spring Security framework provides methods of integrating JWT to secure REST APIs. One of the key...
View ArticleDynamically Register Spring Beans Based on Properties
1. Overview In this tutorial, we’ll explore how to dynamically register beans based on custom properties. We’ll explore the BeanDefinitionRegistryPostProcessor interface and how we can use it to add...
View ArticleAdd One Element to an Immutable List in Java
1. Overview In Java, immutable objects ensure thread safety and prevent unintended modifications, fostering robust and reliable code. However, sometimes, we want to add elements to an immutable list....
View ArticleFlatten a Stream of Maps to a Single Map in Java
1. Overview Since the introduction of Java 8, working with streams of data has become a common task in Java development. Often, these streams contain complex structures like maps, which can pose a...
View ArticleCreating PostgreSQL Schema Before Liquibase Execution
1. Introduction In the realm of database management, ensuring consistency and traceability of schema changes is a good practice for maintaining data integrity and application reliability. Liquibase, a...
View ArticleVigenère Cipher in Java
1. Introduction In this article, we’re going to look at the Vigenère cipher. We’ll see how the cipher works, and then, we’ll learn how to implement and reverse it in Java. 2. What Is the Vigenère...
View ArticleReading a .gz File Line by Line Using GZIPInputStream
1. Overview We may wish to work with compressed files in Java. A common format is .gz, as generated by the GZIP utility. Java has a built-in library for reading .gz files, which are commonly used for...
View ArticleNormalizing the EOL Character in Java
1. Introduction Different operating systems use different end-of-line (EOL) characters, which might lead to problems when files are transferred or processed between systems. Besides, normalizing EOL...
View ArticleConverting UTF-8 to ISO-8859-1 in Java
1. Introduction The issue of character encoding is of vital importance for Java programming when working with several systems and data sources. In this tutorial, we’ll discuss how to convert UTF-8...
View ArticleWhen to Use Setter Methods or Constructors for Setting a Variable’s Value in...
1. Introduction One of the choices that developers encounter is whether setter methods or constructors should be used to set the value of a variable. Both techniques have their benefits, however they...
View ArticleGet List of Entity From Database in Hibernate
1. Introduction Hibernate is a powerful ORM (Object-Relational Mapping) framework that simplifies the interaction between Java objects and relational databases. Hibernate abstracts away the...
View ArticleJava InputStream vs. InputStreamReader
1. Overview In this article, we’ll discuss the InputStream class and how it can handle binary information from various sources. We’ll also discuss the InputStreamReader class and its differences...
View ArticleCreate Spring Prototype Scope Bean with Runtime Arguments
1. Overview In this quick article, we’re going to learn about creating a prototype-scoped bean with runtime arguments in Spring. In Spring, there are many different bean scopes, but the default scope...
View ArticleSaga Pattern in Microservices Architecture
1. Introduction In a typical microservice-based architecture, where a single business use case spans multiple microservices, each service has its own local datastore and localized transaction. When it...
View Article