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