Category: Java

1. JdbcTemplate Introduction If we want to perform CRUD operations on a relational database the Spring ecosystem provides Spring Data JPA and Spring Support for JDBC. Spring Support for JDBC focuses on the JdbcTemplate class, which is internally based on the JDBC API of the Java SDK. Anyone who has ever worked with the JDBC […]Continue reading

Lists are common data structures in Java. Elements in a List have a specific order and can include duplicate elements. List have different implementations based on different use cases. The two key ones are ArrayList and LinkedList. Novice programmers often tend to use both the implementations interchangeably. However, both ArrayList and LinkedList have significant differences […]Continue reading

Timer is a utility class as a facility for Threads to schedule tasks for future execution as a background thread. You can use this class to schedule tasks for one-time execution or for repeated execution at a regular interval. In this post, I’ll explain how to schedule tasks in Java applications using the Timer and […]Continue reading

The Java collection framework provides several collection implementations to store and operate on objects. Some groups of implementations are similar in the operations they perform, and it is common for novice programmers to use them interchangeably. ArrayList and LinkedList are two such implementations that are often confused and incorrectly applied in applications. I have written […]Continue reading

Sorting collections is a common task that Java developers deal with on a daily bases.  The Java Collections class provides us with two sort() methods to sort all collections that implement the List interface. Sorting Primitive Types & Strings In the example below, we will create a list with ten random integers and sort the list using the sort() method, […]Continue reading

Iteration is the most common operations done on a collection. For example, you may want to go through all the student grades to find who has the highest test scores. In Java we have four methods for iterating over a collection, the methods are the for loop, iterator, forEach and lambda expressions. Setup Collection Here […]Continue reading

Problem You are given a string and are asked to write a method to return true if the string is a palindrome and to return false otherwise. A palindrome is a string that reads the same from front to back like alula They are many solutions to check if a string is a palindrome. I’m going […]Continue reading

What Is SDKMAN? As Java developers, we have to work with different versions of Java from project to project. Installing different versions by hand and setting the PATH can become a real pain at times. SDKMAN is a command line tool that allows you to install different versions of Java, Gradle, Maven and more. SDKMAN also takes […]Continue reading

Apache Maven is distributed in several formats. The simplest way to install Maven is to download a ready-made binary distribution archive and follow the installation instructions. Maven 3.3+ release requires JDK 1.7 or above to execute. General Requirements Java JDK must be installed on system. Java 1.7 or higher is needed for Maven. To verify the […]Continue reading

In this post, I will explain the Merge Sort algorithm and how to use it in Java. Sorting is the process of arranging data in ascending or descending order. Sorting becomes necessary while searching a particular record in database, a particular telephone number in telephone directory, words in a dictionary, and so on. In computer […]Continue reading