Category Archives for Java

Sorting Java Collections

February 12, 2019

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, […]

Iterating Over Collections In Java

January 29, 2019

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 […]

Is String A Palindrome?

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 […]

Using SDKMAN To Manage Java Versions

January 20, 2019

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 […]