Convert String Date to XMLGregorianCalendar in Java
1. Overview In this tutorial, we’ll look at various approaches to converting a String Date to an XMLGregorianCalendar. 2. XMLGregorianCalendar The XML Schema standard defines clear rules for specifying...
View ArticleNormalize a URL in Java
1. Introduction Uniform Resource Locators (URLs) are a significant part of web development as they help locate and get resources on the Internet. Yet, URLs may be inconsistent or formatted incorrectly;...
View ArticleGenerating Unique Positive Long Using SecureRandom in Java
1. Overview The SecureRandom class, found in the java.security package, is specifically designed for cryptographic purposes and critical security situations, using algorithms that ensure a high level...
View ArticleLooking for a Backend Java/Spring Team Lead with Integration Experience...
About Us Baeldung is a learning and media company with a focus on the programming space. We’re a flexible, entirely remote team. Description We’re looking for a senior Java developer, ideally with some...
View ArticleRun-Length Encoding and Decoding in Java
1. Overview In computer science, data compression techniques play an important role in optimizing storage and transmission efficiency. One such technique that has stood the test of time is Run-length...
View ArticleCountDownLatch vs. Semaphore
1. Introduction In Java multithreading, effective coordination between threads is crucial to ensure proper synchronization and prevent data corruption. Two commonly used mechanisms for thread...
View ArticleInstantiate an Inner Class With Reflection in Java
1. Overview In this tutorial, we’ll discuss instantiating an inner class or a nested class in Java using the Reflection API. Reflection API is particularly important in scenarios where the structure of...
View ArticleCalculate Weighted Mean in Java
1. Introduction In this article, we’re going to explore a few different ways to solve the same problem – calculating the weighted mean of a set of values. 2. What Is a Weighted Mean? We calculate the...
View ArticleStoring UUID as Base64 String in Java
1. Overview Using a Base64 encoded string is a widely adopted method for storing Universally Unique Identifiers (UUIDs). This provides a more compact result compared to the standard UUID string...
View ArticleInjecting @Mock and @Captor in JUnit 5 Method Parameters
1. Overview In this tutorial, we’ll see how to inject the @Mock and @Captor annotations in unit test method parameters. We can use @Mock in our unit tests to create mock objects. On the other hand, we...
View ArticleJava Weekly, Issue 528
1. Spring and Java >> Simplifying Java Development: Introducing Multi-File Program Launching [infoq.com] JEP 458 Unleashed: Empowering Seamless Development with Multi-File Source-Code Programs in...
View ArticleFind the Equilibrium Indexes of an Array in Java
1. Overview In this tutorial, we’ll first learn the definition of the equilibrium indexes of an array. Subsequently, we’ll write a method to identify and locate them. 2. Presentation of the Problem...
View ArticleConvert Date to Unix Timestamp in Java
1. Overview In computer science, Unix timestamp, also known as epoch time, is a standard way to represent a particular point in time. It denotes the number of seconds that have elapsed since January 1,...
View ArticleTranslating Space Characters in URLEncoder
1. Introduction When working with URLs in Java, it’s essential to ensure they are properly encoded to avoid errors and maintain accurate data transmission. URLs may contain special characters,...
View ArticleQuarkus and Virtual Threads
1. Overview In the ever-evolving landscape of Java development, the introduction of Java 21 brought forth a revolutionary feature – virtual threads. These lightweight threads, managed by the Java...
View ArticleCreating a Custom URL Connection
1. Introduction In Java, the URLConnection class provides basic functionality for connecting to resources specified by a URL. However, in certain scenarios, developers may need a custom implementation...
View ArticlePagination With JDBC
1. Introduction Large table reads can cause our application to run out of memory. They also add extra load to the database and require more bandwidth to execute. The recommended approach while reading...
View ArticleUnderstanding “Raw type. References to generic types should be parameterized”...
1. Overview Raw types are an advanced topic in Java. It required a good understanding of parametrized classes but might still be confusing. Luckily, IDEs can help us when we get things wrong. In...
View ArticleRun Maven From Java Code
1. Overview Maven is an integral tool for the majority of Java projects. It provides a convenient way to run and configure the build. However, in some cases, we need more control over the process....
View ArticleA Guide to the @SoftDelete Annotation in Hibernate
1. Overview While working with databases in our applications, we usually have to deal with deleting records that are no longer useful. However, due to business or regulatory requirements, such as data...
View Article