Quantcast
Channel: Baeldung
Browsing all 4535 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Convert 2D Array Into 1D Array

1. Overview Arrays are the most basic data structures in any language. Although we don’t work on them directly in most cases, knowing how to manipulate them efficiently can dramatically improve our...

View Article


Image may be NSFW.
Clik here to view.

How to Test a Spring AOP Aspect

1. Overview Aspect-oriented programming (AOP) improves program design by separating a cross-cutting concern into a base unit, called an aspect, from the main application logic. Spring AOP is a...

View Article


Image may be NSFW.
Clik here to view.

Generate Java Classes From Avro Schemas Using Gradle

1. Overview In this tutorial, we’ll learn how to generate Java classes from an Apache Avro schema. First, we’ll familiarize ourselves with two methods: using the existing Gradle plugin and implementing...

View Article

Image may be NSFW.
Clik here to view.

Difference Between Lombok @AllArgsConstructor, @RequiredArgsConstructor and...

1. Overview Project Lombok reduces boilerplate code in Java applications by providing annotations that automatically generate commonly used code. In this tutorial, we’ll explore the differences between...

View Article

Image may be NSFW.
Clik here to view.

Introduction to Java 22

1. Introduction In this tutorial, we’ll dive deep into the latest Java release, Java 22, which is now in General Availability. 2. Java Language Updates Let’s talk about all the new changes to the Java...

View Article


Image may be NSFW.
Clik here to view.

Get JSON Content as Object Using MockMVC

1. Overview When testing our REST endpoints, sometimes we want to obtain the response and convert it to an object for further checking and validation. As we know, one way to do this is by using...

View Article

Image may be NSFW.
Clik here to view.

Using MapStruct With Inheritance

1. Overview MapStruct is a Java annotation processor that comes in handy when generating type-safe and effective mappers for Java bean classes. In this tutorial, we’ll specifically learn how to use the...

View Article

Image may be NSFW.
Clik here to view.

How to Unit Test an ExecutorService Without Using Thread.sleep()

1. Overview An ExecutorService object runs tasks in the background. Unit testing a task that runs on another thread is challenging. The parent thread must wait for the task to end before asserting its...

View Article


Image may be NSFW.
Clik here to view.

Mapping Enum to String Using MapStruct

1. Introduction MapStruct is an efficient, type-safe library that simplifies data mapping between Java objects, eliminating the need for manual conversion logic. In this tutorial, we’ll explore the use...

View Article


Image may be NSFW.
Clik here to view.

How to Implement Elvis Operator in Java 8

1. Introduction In Java 8, there is no built-in Elvis operator like in Groovy or Kotlin. However, we can implement our own Elvis operator using method references and the ternary operator. In this...

View Article

Image may be NSFW.
Clik here to view.

Casting Maps to Complex Objects

1. Overview Manipulating and reconstructing data is often a crucial part of programming in Java. One powerful technique involves casting Map objects into complex objects or POJOs. This can allow us to...

View Article

Image may be NSFW.
Clik here to view.

Avoiding the IndexOutOfBoundsException When Using List.subList() in Java

1. Overview In this short tutorial, we’ll learn how to avoid IndexOutOfBoundsException when working with the subList() method provided by the List interface. Initially, we’ll discuss how subList()...

View Article

Image may be NSFW.
Clik here to view.

Get the Position of Key/Value in LinkedHashMap Using Its Key

1. Introduction The LinkedHashMap class provides a convenient way to maintain the insertion order of key-value pairs while still offering the functionality of a HashMap. In this tutorial, we’ll explore...

View Article


Image may be NSFW.
Clik here to view.

How to Convert Between java.sql.Timestamp and ZonedDateTime in Java

1. Overview Handling timеstamps in Java is a common task that allows us to manipulatе and display datе and timе information morе еffеctivеly еspеcially when we’re dealing with databasеs or global...

View Article

Image may be NSFW.
Clik here to view.

Collecting into Map using Collectors.toMap() vs Collectors.groupingBy()

1. Overview In Java programming, working with collections and streams is a common task, especially in modern, functional programming paradigms. Java 8 introduced the Stream API, which provides powerful...

View Article


Image may be NSFW.
Clik here to view.

Fix Spring Boot H2 JdbcSQLSyntaxErrorException “Table not found”

1. Introduction H2 provides a simple in-memory and lightweight database that Spring Boot can configure automatically, making it easy for developers to test data access logic. Typically,...

View Article

Image may be NSFW.
Clik here to view.

Save Child Objects Automatically Using JPA

1. Overview Sometimes we deal with entities with complex models consisting of parent and child elements. In this scenario, it can be beneficial to save the parent entity, thereby automatically saving...

View Article


Image may be NSFW.
Clik here to view.

OpenAPI Custom Generator

1. Introduction In this tutorial, we’ll continue to explore OpenAPI Generator‘s customization options. This time, we’ll show how the required steps to create a new generator that creates REST Producer...

View Article

Image may be NSFW.
Clik here to view.

Converting short to byte[] in Java

1. Introduction Converting a short value to a byte[] array is a common task in Java programming, especially when dealing with binary data or network communication. In this tutorial, we’ll explore...

View Article

Image may be NSFW.
Clik here to view.

Inheritance vs. Composition in JPA

1. Introduction Inheritance and composition are two fundamental concepts in object-oriented programming (OOP) that we can also leverage in JPA for data modeling. In JPA, both inheritance and...

View Article
Browsing all 4535 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>