Call Methods at Runtime Using Java Reflection
1. Overview In this short article, we’ll take a quick look at how to invoke methods at runtime using the Java Reflection API. 2. Getting Ready Let’s create a simple class which we’ll use for the...
View ArticleGuide to the Java Phaser
1. Overview In this article, we will be looking at the Phaser construct from the java.util.concurrent package. It is a very similar construct to the CountDownLatch that allows us to coordinate...
View ArticleJHipster with a Microservice Architecture
1. Introduction In this writeup, we’ll explore an interesting example with JHipster – building a simple microservices architecture. We’ll show how to build and deploy all the required pieces, and in...
View ArticleA Guide to @RepeatedTest in Junit 5
1. Overview In this quick article, we are going to look at the @RepeatedTest annotation introduced in JUnit 5. It provides us a powerful way to write any test that we want to repeat several times. If...
View ArticleJava Web Weekly, Issue 176
Lots of interesting writeups on Java 9 this week. Here we go… 1. Spring and Java >> Concurrency: Java Futures and Kotlin Coroutines [frankel.ch] A comprehensive and practical comparison of...
View ArticleGuide to Guava ClassToInstanceMap
1. Overview A ClassToInstanceMap<B> is a special kind of map that associates classes with corresponding instances. It makes sure that all the keys and the values are subtypes of the upper bound...
View ArticleCustom Reporting with TestNG
1. Overview In this article, we will discuss generating custom logging and reports using TestNG. TestNG provides its own reporting feature – generating reports in either HTML/XML formats. If tests are...
View ArticleGuide to DelayQueue
1. Overview In this article, we’ll be looking at the DelayQueue construct from the java.util.concurrent package. This is a blocking queue that could be used in producer-consumer programs. It has a...
View ArticleCount Occurrences of a Char in a String
1. Overview There are many ways to count the number of occurrences of a char in a String in Java. In this quick article, we’ll focus on a few examples of how to count characters, first, with the core...
View ArticleJava 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...
View ArticleThe StackOverflowError in Java
1. Overview StackOverflowError can be annoying for Java developers, as it’s one of the most common runtime errors we can encounter. In this article, we’ll see how this error can occur by looking at a...
View ArticleGuide to Guava MinMaxPriorityQueue and EvictingQueue
1. Overview In this article, we’ll be looking at the EvictingQueue, and MinMaxPriorityQueue constructs from the Guava library. The EvictingQueue is an implementation of the circular buffer concept....
View ArticleSplit a String in Java
1. Introduction Splitting Strings is a very frequent operation; this quick tutorial is focused on some of the API we can use to do this simply in Java. 2. String.split() Let’s start with the core...
View ArticleIntroduction to Java Serialization
1. Introduction Serialization is the conversion of the state of an object into a byte stream; deserialization does the opposite. Stated differently, serialization is the conversion of a Java object...
View ArticleGuide to Mathematical Operations with Guava
1. Overview In this article, we will see some useful Mathematical Operations available in the Guava Library. There are four maths utility classes available with Guava: IntMath – operation on int...
View ArticleHow to Remove the Last Character of a String?
1. Overview In this quick article, we are going to check and discuss different techniques for removing the last character of a String. 2. Using String.substring() The easiest way is to use the...
View ArticleDifference Between “==” and “===” operators in Kotlin
1. Overview In this article, we are going to talk about the difference between “==” and “===” operators in Kotlin. In Kotlin, just like in Java, we have two different concepts of equality, Referential...
View ArticleGuide to Synchronized Keyword in Java
1. Overview This quick article will be an intro to using the synchronized block in Java. Simply put, in a multi-threaded environment, a race condition occurs when two or more threads attempt to update...
View ArticleIntroduction to Drools
1. Overview Drools is a Business Rule Management System (BRMS) solution. It provides a rule engine which processes facts and produces output as a result of rules and facts processing. Centralization...
View ArticleJava Web Weekly, Issue 177
Lots of interesting writeups on Java 9 this week. Here we go… 1. Spring and Java >> Is Jigsaw Dead? Not quite. [tomitribe.com] A very needed clarification of the JCP process and what has...
View Article