Sorting Arrays in Java 1. Overview In this tutorial, we’ll discuss common methods to sort arrays in ascending and descending order. We’ll look at using Java’s Arrays class sorting method as well as implementing our own Comparator to order our arrays’ values. 2. Object Definitions Before we begin, let’s quickly define a few… Continue Reading java-sorting-arrays

Permutations of an Array in Java 1. Introduction In this article, we’ll look at how to create permutations of an array. First, we’ll define what a permutation is. Second, we’ll look at some constraints. And third, we’ll look at three ways to calculate them: recursively, iteratively, and randomly. We’ll focus on… Continue Reading java-array-permutations

Converting Between an Array and a Set in Java 1. Overview In this short article we’re going to look at converting between an array and a Set – first using plain java, then Guava and the Commons Collections library from Apache. This article is part of the “Java – Back… Continue Reading convert-array-to-set-and-set-to-array

Removing the First Element of an Array 1. Overview In this tutorial, we’ll look at how to remove the first element of an array. In addition, we’ll also see how using data structures from the Java Collections Framework makes things even easier. 2. Using Arrays.copyOfRange() First of all, removing an element… Continue Reading java-array-remove-first-element