Java 8 Collectors toMap
1. Introduction In this tutorial, we’re going to talk about the toMap() method of the Collectors class. We use it to collect Streams into a Map instance. For all the examples covered in here, we’ll use...
View ArticleUsing SpringJUnit4ClassRunner with Parameterized
1. Overview In this article, we’ll see how to parameterize a Spring integration test implemented in JUnit4 with a Parameterized JUnit test runner. 2. SpringJUnit4ClassRunner SpringJUnit4ClassRunner is...
View ArticleIntroduction to Quasar in Kotlin
1. Introduction Quasar is a Kotlin library that brings some asynchronous concepts to Kotlin in an easier to manage way. This includes lightweight threads, Channels, Actors, and more. 2. Setting Up the...
View ArticleA Guide to Crawler4j
1. Introduction We see web crawlers in use every time we use our favorite search engine. They’re also commonly used to scrape and analyze data from websites. In this tutorial, we’re going to learn how...
View ArticleJava Weekly, Issue 284
Here we go… 1. Spring and Java >> Introducing Spring Cloud App Broker [spring.io] With this Spring Cloud Services 3.0 release, it’s even easier to develop your own service broker with less...
View ArticleDecode an OkHttp JSON Response
1. Introduction In this article, we’ll see several techniques for decoding a JSON response while using OkHttp. 2. OkHttp Response OkHttp is an HTTP client for Java and Android with features like...
View ArticleSpring Session with MongoDB
1. Overview In this quick tutorial, we’ll be exploring how to use the Spring Session backed with MongoDB, both with and without Spring Boot. Spring Session can also be backed with other stores such as...
View ArticleWorking with XML in Groovy
1. Introduction Groovy provides a substantial number of methods dedicated to traversing and manipulating XML content. In this tutorial, we’ll demonstrate how to add, edit, or delete elements from XML...
View ArticleHibernate Validator Specific Constraints
1. Overview In this tutorial, we’re going to review Hibernate Validator constraints, which are built into Hibernate Validator but are outside the Bean Validation spec. For a recap of Bean Validation,...
View ArticleJava Optional as Return Type
1. Introduction The Optional type was introduced in Java 8. It provides a clear and explicit way to convey the message that there may not be a value, without using null. When getting an Optional...
View ArticleThe Spring Boot Starter Parent
1. Introduction In this tutorial, we’ll learn about spring-boot-starter-parent and how we can benefit from it for better dependency management, default configurations for plugins and quickly build our...
View ArticleIntegrating Groovy into Java Applications
1. Introduction In this tutorial, we’ll explore the latest techniques to integrate Groovy into a Java Application. 2. A Few Words About Groovy The Groovy programming language is a powerful,...
View ArticleCopying Sets in Java
1. Overview A Set is a collection that contains no duplicate elements. In Java, Set is an interface that extends the Collection interface. In this tutorial, we’ll go through different ways of copying...
View ArticleIntroduction to SPF4J
1. Overview Performance testing is an activity often pushed towards the end stages of the software development cycle. We usually rely on Java profilers to help troubleshoot performance issues. In this...
View ArticleJava Weekly, Issue 287
Here we go… 1. Spring and Java >> Java 13 Text Blocks [vojtechruzicka.com] A first look at Multiline String Literals in JEP-355: Text Blocks (Preview) — they’re not quite the same as the Raw...
View ArticleHow to Break from Java Stream forEach
1. Overview As Java developers, we often write code that iterates over a set of elements and performs an operation on each one. The Java 8 streams library and its forEach method allow us to write that...
View ArticleConverting Iterator to List
1. Overview In this short tutorial, we’ll learn how to convert an Iterator to a List in Java. We’ll cover a few examples using a while loop, Java 8, and a few common libraries. We’ll use an Iterator...
View ArticleJava IntStream Conversions
1. Introduction In this quick tutorial, we’ll go through all the possibilities regarding IntStream conversions to other types. Interesting readings about boxing and unboxing or iterating are...
View ArticleTemplating with Handlebars
1. Overview In this tutorial, we’ll look into the Handlebars.java library for easy template management. 2. Maven Dependencies Let’s start with adding the handlebars dependency: <dependency>...
View ArticleJava 8 Stream skip() vs limit()
1. Introduction In this short article, we’ll talk about the skip() and limit() methods of the Java Stream API and highlight their similarities and differences. Even though these two operations may look...
View Article