Guide to Stream Redirections in Linux
1. Introduction Whenever we work on the Linux command line, we often have to pass data from one command to another, like feeding a list of find results into a grep. This is where streams come into...
View ArticleHow to Count Duplicate Elements in Arraylist
1. Overview In this short tutorial, we'll look at some different ways to count the duplicated elements in an ArrayList. 2. Loop with Map.put() Our expected result would be a Map object, which contains...
View ArticleBest Practices for REST API Error Handling
1. Introduction REST is a stateless architecture in which clients can access and manipulate resources on a server. Generally, REST services utilize HTTP to advertise a set of resources that they manage...
View ArticleIntro to Spring Data Geode
1. Overview Apache Geode provides data management solutions through a distributed cloud architecture. It would be ideal to utilize the Spring Data APIs for the data access through the Apache Geode...
View ArticleConcatenating Files in Linux
1. Introduction Sometimes, we need to do some operations that require using multiple files at the same time. This can be something as common as searching for some text in multiple files or merging...
View ArticleFile System Mocking with Jimfs
1. Overview Typically, when testing components that make heavy use of I/O operations, our tests can suffer from several issues such as poor performance, platform dependency, and unexpected state. In...
View ArticleTesting a Spring Batch Job
1. Introduction Unlike other Spring-based applications, testing batch jobs comes with some specific challenges, mostly due to the asynchronous nature of how jobs are executed. In this tutorial, we're...
View ArticleMapping a Single Entity to Multiple Tables in JPA
1. Introduction JPA makes dealing with relational database models from our Java applications less painful. Things are simple when we map every table to a single entity class. But, sometimes we have...
View ArticleConverting Java Date to OffsetDateTime
1. Introduction In this tutorial, we learn about the difference between Date and OffsetDateTime. We also learn how to convert from one to the other. 2. Difference between Date and OffsetDateTime...
View ArticleJava Scanner hasNext() vs. hasNextLine()
1. Overview The Scanner class is a handy tool that can parse primitive types and strings using regular expressions and was introduced into the java.util package in Java 5. In this short tutorial, we'll...
View ArticleDefensive Copies for Collections Using AutoValue
1. Overview Creating immutable value objects introduces a bit of unwanted boilerplate. Also, Java's standard collections types have the potential to introduce mutability to value objects where this...
View ArticleSetting Permissions with chown and chmod
1. Overview The Linux operating system is a multi-user operating system. It has a security system in place that controls which users and groups have access to the files and directories in the system....
View ArticleCustomizing the Result of JPA Queries with Aggregation Functions
1. Overview While Spring Data JPA can abstract the creation of queries to retrieve entities from the database in specific situations, we sometimes need to customize our queries, such as when we add...
View ArticleGuide to the Linux find Command
1. Introduction The Linux find command can be used to find files and directories on a disk. It provides several command-line options that make it a powerful tool. In this tutorial, we'll look at how to...
View ArticleLinux Commands – top
1. Overview It's quite common to find ourselves in a situation where we need to know the resource usage of each process and thread in our system. For example, we might want to know which process is...
View ArticleCauses & Avoidance of java.lang.VerifyError
1. Introduction In this tutorial, we'll look at the cause of java.lang.VerifyError errors and multiple ways to avoid it. 2. Cause The Java Virtual Machine (JVM) distrusts all loaded bytecode as a core...
View ArticlePipes and Redirection in Linux
1. Introduction Most shells offer the ability to alter the way that application input and output flows. This can direct output away from the terminal and into files or other applications, or otherwise...
View ArticleGenerating Random Dates in Java
1. Overview In this tutorial, we're going to see how to generate random dates and times in bounded and unbounded fashions. We'll be looking at how to generate these values using the legacy...
View ArticleJava Weekly, Issue 305
1. Spring and Java >> Spring Cloud Stream – and Spring Integration. [spring.io] Find out how to combine these two to implement function-based streams. >> JVM numeric types – Integer types...
View ArticlePractical Application of Test Pyramid in Spring-based Microservice
1. Overview In this tutorial, we'll understand the popular software-testing model called the test pyramid. We'll see how it's relevant in the world of microservices. In the process, we'll develop a...
View Article