Immutable Objects in Java
1. Overview In this tutorial, we’ll learn what makes an object immutable, how to achieve immutability in Java, and what advantages come with doing so. 2. What’s an Immutable Object? An immutable...
View ArticleJava 8 Unsigned Arithmetic Support
1. Overview From the dawn of Java, all numerical data types are signed. In many situations, however, it’s required to use unsigned values. For example, if we count the number of occurrences of an...
View ArticleHow to Get the File Extension of a File in Java
1. Overview In this quick tutorial, we’ll show how to obtain the file extension programmatically in Java. We’ll focus on three major approaches to the problem. In our implementations, the characters...
View ArticleConvert a String to Title Case
1. Introduction In this short tutorial, we’ll show how to convert a String to title case format in Java. We’ll show different ways of implementing a custom method and we’ll also show how to do it...
View ArticleAn Introduction to CDI (Contexts and Dependency Injection) in Java
1. Overview CDI (Contexts and Dependency Injection) is a standard dependency injection framework included in Java EE 6 and higher. It allows us to manage the lifecycle of stateful components via...
View ArticleJava with ANTLR
1. Overview In this tutorial, we’ll do a quick overview of the ANTLR parser generator and show some real-world applications. 2. ANTLR ANTLR (ANother Tool for Language Recognition) is a tool for...
View ArticleGet Date Without Time in Java
1. Introduction In this short tutorial, we’ll show how to get a Date without time in Java. We’ll show how to do this before and after Java 8 since things have become a bit different after the release...
View ArticleTesting Callbacks with Mockito
1. Overview In this short tutorial, we’ll focus on how to test Callbacks using the popular testing framework Mockito. We’ll explore two solutions, firstly using an ArgumentCaptor and then the...
View ArticleKotlin String Templates
1. Overview In this tutorial, we’ll explain what Kotlin’s String templates are and how to use them. In order to get familiar with other features and to know how to use Kotlin, have a look at one of...
View ArticleGuide to Maven Archetype
1. Overview A Maven archetype is an abstraction of a kind of a project that can be instantiated into a concrete customized Maven project. In short, it’s a template project template from which other...
View ArticleImportance of Main Manifest Attribute in a Self-Executing JAR
1. Overview Every executable Java class has to contain a main method. Simply put, this method is a starting point of an application. To run our main method from a self-executing JAR file, we have to...
View ArticleThe DAO Pattern in Java
1. Overview The Data Access Object (DAO) pattern is a structural pattern that allows us to isolate the application/business layer from the persistence layer (usually a relational database, but it...
View ArticleJava Weekly, Issue 235
Here we go… 1. Spring and Java >> The Current State of Java Value Types [infoq.com] An interesting post that highlights the possible semantics of value types in Java, along with some hurdles...
View ArticleSpring with Thymeleaf Pagination for a List
1. Overview In this quick tutorial, we’ll build a simple application to display a list of items with pagination using Spring and Thymeleaf. For an introduction on how to integrate Thymeleaf with...
View ArticleHow to Get the Start and the End of a Day using Java
1. Overview In this short tutorial, we’ll learn how to get the start and the end of a day in Java, using simple, straightforward examples for different scenarios. We’ll be using the Java’s 8 Date/Time...
View ArticleExtracting Year, Month and Day from Date in Java
1. Overview In this short tutorial, we’ll look at how to extract the year, month and day from a given Date in Java. We’ll be looking at how to extract these values using the legacy java.util.Date...
View ArticleConverting Between Roman and Arabic Numerals in Java
1. Introduction The ancient Romans developed their own numeric system called Roman numerals. The system uses letters with different values to represent numbers. Roman numerals are still used today in...
View ArticleSpring Boot Console Application
1. Overview In this quick tutorial, we’ll explore how to create a simple console-based application using Spring Boot. 2. Maven Dependencies Our project relies on the spring-boot parent: <parent>...
View ArticleCreate a Custom Exception in Java
1. Introduction In this tutorial, we’ll cover how to create a custom exception in Java. We’ll show how user-defined exceptions are implemented and used for both checked and unchecked exceptions. 2....
View ArticleSpring AMQP in Reactive Applications
1. Overview This tutorial shows how to create a simple Spring Boot Reactive Application that integrates with the RabbitMQ messaging server, a popular implementation of the AMQP messaging standard. We...
View Article