How to Use if/else Logic in Java 8 Streams
1. Overview In this tutorial, we’re going to demonstrate how to implement if/else logic with Java 8 Streams. As part of the tutorial, we’ll create a simple algorithm to identify odd and even numbers....
View ArticleJava Weekly, Issue 250
Here we go… 1. Spring and Java >> How Java Maps Protect Themselves From DOS Attacks [javaspecialists.eu] A deep dive into the evolution of the hashCode method in the String class. A fascinating...
View ArticleUse the Latest Version of a Dependency in Maven
1. Overview Upgrading Maven dependencies manually has always been a tedious work, especially in projects with a lot of libraries releasing frequently. In this tutorial, we’ll learn how to exploit the...
View ArticleGuide to DateTimeFormatter
1. Overview In this tutorial, we’ll review the Java 8 DateTimeFormatter class and its formatting patterns. We’re also going to discuss possible use cases for this class. We can use DateTimeFormatter...
View ArticleDifference Between @NotNull, @NotEmpty, and @NotBlank Constraints in Bean...
1. Overview Bean Validation is a standard validation specification that allows us to easily validate domain objects by using a set of constraints declared in the form of annotations. While overall,...
View ArticleGuide to EnumSet
1. Introduction In this tutorial, we’ll explore the EnumSet collection from the java.util package and discuss its peculiarities. We’ll first show the main features of the collection and after that,...
View ArticleWrite an org.w3.dom.Document to a File
1. Overview An important part of XML handling is creating XML files that can be consumed by others. When handling XML in Java, we’ll often have an instance of org.w3c.dom.Document that we need to...
View ArticleSetting the Java Version in Maven
1. Overview In this quick tutorial, we’ll show how to set the Java version in Maven. Before moving ahead, we can check the default JDK version of Maven. Running the mvn -v command will show the Java...
View ArticleConverting Between Byte Arrays and Hexadecimal Strings in Java
1. Overview In this tutorial, we’ll take a look at different ways to convert a byte array to a hexadecimal String, and vice versa. We’ll also understand the conversion mechanism and write our...
View ArticleJava 8 Streams: Find Items From One List Based On Values From Another List
1. Overview In this quick tutorial, we’ll learn how to find items from one list based on values from another list using Java 8 Streams. 2. Using Java 8 Streams Let’s start with two entity classes –...
View ArticleGuide to Ebean ORM
1. Introduction Ebean is an object-relational mapping tool written in Java. It supports the standard JPA annotations for declaring entities. However, it provides a much simpler API for persisting. In...
View ArticleMulti-Module Project with Maven
1. Overview In this tutorial, we’ll show how to build a multi-module project with Maven. First, we’ll discuss what’s a multi-module project and have a look at the benefits of following this approach....
View ArticleExploring the Jersey Test Framework
1. Overview In this tutorial, we’re going to take a look at the Jersey Test Framework and see how we can use it to quickly write integration tests. As we’ve already seen in previous articles, Jersey...
View ArticleAn Introduction to Spring Data Redis Reactive
1. Introduction In this tutorial, we’re going to learn how to configure and implement Redis operations using Spring Data’s ReactiveRedisTemplate. We’ll go over the basic usages of the...
View ArticleJAVA_HOME should point to a JDK not a JRE
1. Introduction In this tutorial, we’re going to talk about an exception that Maven throws when misconfigured: JAVA_HOME should point to a JDK, not a JRE. Maven is a powerful tool for building code....
View ArticleUsing JUnit 5 with Gradle
1. Overview In this tutorial, we’re going to run tests on the new JUnit 5 platform with the Gradle build tool. We’ll configure a project that supports both the old and the new version. Feel free to...
View ArticleThe Modulo Operator in Java
1. Overview In this short tutorial, we’re going to show what the modulo operator is, and how we can use it with Java for some common use cases. 2. The Modulo Operator Let’s start with the shortcomings...
View ArticleConvert XML to JSON Using Jackson
1. Overview In this tutorial, we’ll see how to convert an XML message to JSON using Jackson. For readers new to Jackson, consider getting familiar with the basics first. 2. An Introduction to Jackson...
View ArticleConcrete Class in Java
1. Introduction In this quick guide, we’ll discuss the term “concrete class” in Java. First, we’ll define the term. Then, we’ll see how it’s different from interfaces and abstract classes. 2. What is...
View ArticleAn Introduction to Synchronized Java Collections
1. Overview The collections framework is a key component of Java. It provides an extensive number of interfaces and implementations, which allows us to create and manipulate different types of...
View Article