Created class PathComparator to compare Path's in order to be able to sort them. To use this comparator you have to call Collections.sort(arrayListOfPaths, new PathComparator());