Quantcast
Browsing all 758 articles
Browse latest View live

Java Object Mapping Made Easy: A Guide to MapStruct

Juggling data conversions between different object structures can be a tedious and error-prone task in Java applications. Traditionally, developers write manual mapping code to transform data from one...

View Article


Java Stream contains, containsAny and containsAll examples

The Java 8 Stream API provides various methods for operating on sequences of elements, such as filtering, mapping, and collecting. Among these operations, checking for the presence of elements can be...

View Article


Unit Testing of ExecutorService in Java With No Thread sleep

Unit testing concurrent code, especially code utilizing ExecutorService, presents unique challenges due to its asynchronous nature. Traditional approaches often involve using Thread.sleep() to wait for...

View Article

MapStruct With Inheritance Examples

1. Introduction MapStruct is an open-source, compile-time code generator, and annotation processor. It simplifies the implementation of mappings between different Java bean types based on a convention...

View Article

Lucene MMapDirectory and ByteBuffersDirectory Examples

Apache Lucene is a powerful search library written in Java. It provides various directory implementations for storing index files, such as ByteBuffersDirectory and MMapDirectory. These directories...

View Article


Spring Boot JpaRepository Example

Hello readers let us delve into understanding the Spring Data JPA module. 1. JpaRepository interface Spring Data JPA provides a powerful abstraction over the data access layer, allowing developers to...

View Article

Moshi BigDecimal requires explicit JsonAdapter

When working with JSON in Java, handling numerical data with precision is crucial, especially in financial applications. The BigDecimal class in Java provides arbitrary-precision arithmetic, which...

View Article

Finding a Key’s Index in Java LinkedHashMap

The Java LinkedHashMap class combines a hash table and linked list to maintain predictable iteration order, unlike HashMap. However, LinkedHashMap does not provide a direct method to get the position...

View Article


Spring JPA LIKE Query Example With JdbcTemplate or JpaRepository

LIKE queries in SQL allow users to search for specified patterns in the database table columns, enabling flexible and dynamic querying capabilities. The operator is often used with wildcard characters...

View Article


A Guide to Interfaces and Abstract Classes in Java

Java, a powerhouse programming language, offers a variety of tools to write clean, maintainable, and reusable code. Two of these essential tools are interfaces and abstract classes. While both promote...

View Article

The Power of Wrapper Classes in Java

In the world of Java programming, primitive data types reign supreme for their efficiency in storing basic values like numbers and characters. But what if you need the power of objects to work with...

View Article

Collectors.toMap() vs Collectors.groupingBy() in Java Streams

Java Streams offer powerful ways to process collections of elements. Two common operations involve transforming a stream into a map: Collectors.toMap() vs Collectors.groupingBy(). While both can be...

View Article

Spring Boot MVC REST Controller Example & Unit Tests

In modern web development, REST APIs are essential for enabling communication between different systems and platforms. The Spring Framework, particularly Spring Boot, provides robust support for...

View Article


Converting Between java.sql.Timestamp and ZonedDateTime in Java

In Java, conversion between java.sql.Timestamp and java.time.ZonedDateTime can be essential for applications that interact with legacy systems that require this specific type and need to handle date...

View Article

Boosting Performance with Parallel Streams

In today’s world of big data and complex computations, programmers constantly seek ways to optimize their code for speed. Java 8 introduced a powerful tool for this purpose: parallel streams. These...

View Article


Automatically Saving Child Entities in JPA

In JPA applications, we often encounter entities with parent-child relationships. Persisting these entities efficiently involves saving the parent and automatically persisting its associated child...

View Article

Resolving Spring Boot H2 JdbcSQLSyntaxErrorException: “Table not found”

Spring Boot makes it easy to develop Spring applications with its pre-configured components. However, we often encounter the JdbcSQLSyntaxErrorException: Table not found error when using the H2...

View Article


Queue to List Conversion in Java

Queues and Lists are fundamental data structures in Java. The Java’s Queue interface represents a collection designed for holding elements prior to processing and used extensively in scenarios...

View Article

Exploring Different Techniques to Iterate a List of Maps in Java

In Java, iterating through a list of maps is a common operation with several techniques available, each offering distinct advantages. This article explores some of the most common methods, providing a...

View Article

Getting Started with LangChain4j and Spring Boot

The LangChain4j framework is an open-source library designed to seamlessly integrate Language Learning Models (LLMs) into Java applications. Drawing inspiration from the widely-used LangChain framework...

View Article
Browsing all 758 articles
Browse latest View live