Skip to content
sneppets

sneppets

  • Privacy
Arrays.sort() NullPointerException

Arrays.sort(), compareTo NullPointerException

November 13, 2018August 6, 2024 Editorial Staff

Are you getting NullPointerException while using Arrays.sort() and Comparable and don’t know exactly where is the problem in your code ? Solution You may get this exception when you miss any element or something is null. Check the following example,… Read More!

Java arrays sort, comparable, compareTo, NullPointerException
sort objects

Sort objects in Java using Insertion Sort

November 1, 2018December 8, 2018 Editorial StaffLeave a Comment on Sort objects in Java using Insertion Sort

In our Java program below we use insertion sort to sort Student objects based on the lastName key values. The doInsertionSort() method in this example is similar to doInsertionSort() method in the insertion sort example, but the only difference is we… Read More!

Algo, Java comparable, comparator, insertion sort, sort objects
Copyright © 2018 Sneppets. All Rights Reserved