Author: iba
-
The Java Comparable interface – Automatically sort collections
In this post, we will explore how to use the Java comparable interface to automatically sort collections of any classes. We will use the Java Collections from the util library as an example. Why interfaces are so important? Java interfaces are one of the most powerful features of the object oriented programming language. When a…
-
How to improve the performance of ArrayLists in Java
In this post we will discuss the little known trick of setting an ArrayList’s initial capacity to improve the performance of your Java applications and optimizing the usage of the often used data structure. The good news is that it takes a minimal amount of work and can get you a performance boost of up…
-
Spring Boot & Freemarker Configuration Example
Freemarker is a powerful Java template engine. It can be used to generate basically anything, from HTML pages, configuration files, e-mails, or anything else. All you need to do is define your template, use Java to prepare the data, and use the Freemarker engine to process your data with the given template to produce the…
-
Java NullPointerException – examples, causes and fixes
Probably one of the most common and annoying exceptions to be encountered by any Java developer is the dreaded “NullPointerException”. A null pointer exception is thrown when an “illegal” referencing of a null object is performed. A “null” object is an object which is not initialized. Let us explore some examples of how a null…
-
How to install Maven 3.5.x on Windows
In the following article, we will find out how to install Apache Maven on Windows. We will be using Windows 8.1 and Maven 3.5.4 in this guide, but the instructions should also be valid for other software versions. Before we start, make sure that you have JDK installed properly on your machine. Next, we will…