Array Processing with Apache Commons Lang 3 1. Overview The Apache Commons Lang 3 library provides support for manipulation of core classes of the Java APIs. This support includes methods for handling strings, numbers, dates, concurrency, object reflection and more. In this quick tutorial, we’ll focus on array processing with… Continue Reading array-processing-commons-lang

Retrieving a Class Name in Java 1. Overview In this tutorial, we’ll learn about four ways to retrieve a class’s name from methods on the Class API: getSimpleName(), getName(), getTypeName() and getCanonicalName().  These methods can be confusing because of their similar names and their somewhat vague Javadocs. They also have some nuances when it… Continue Reading java-class-name

What is the serialVersionUID? 1. Overview Simply put, the serialVersionUID is a unique identifier for Serializable classes. This is used during the deserialization of an object, to ensure that a loaded class is compatible with the serialized object. If no matching class is found, an InvalidClassException is thrown. 2. Example… Continue Reading java-serial-version-uid

Java @SuppressWarnings Annotation 1. Overview In this quick tutorial, we’ll have a look at how to use the @SuppressWarnings annotation. 2. @SuppressWarnings Annotation Compiler warning messages are usually helpful. Sometimes warnings can get noisy, though. Especially when we can’t or don’t want to address them: public class Machine { private List… Continue Reading java-suppresswarnings

Java Double Brace Initialization 1. Overview In this quick tutorial, we’ll show how double braces can be used for creating and initializing objects in a single Java expression. We’ll also look at why this technique can be considered an anti-pattern. 2. Standard Approach Normally we initialize and populate a set… Continue Reading java-double-brace-initialization