Class CollectionUtils
java.lang.Object
nonapi.io.github.classgraph.utils.CollectionUtils
Collection utilities.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Comparable<T>>
List<T> sortCopy
(Collection<T> elts) Copy and sort a collection.static <T extends Comparable<? super T>>
voidsortIfNotEmpty
(List<T> list) Sort a collection if it is not empty (to preventConcurrentModificationException
if an immutable empty list that has been returned more than once is being sorted in one thread and iterated through in another thread -- #334).static <T> void
sortIfNotEmpty
(List<T> list, Comparator<? super T> comparator) Sort a collection if it is not empty (to preventConcurrentModificationException
if an immutable empty list that has been returned more than once is being sorted in one thread and iterated through in another thread -- #334).
-
Constructor Details
-
CollectionUtils
private CollectionUtils()Class can't be constructed.
-
-
Method Details
-
sortIfNotEmpty
Sort a collection if it is not empty (to preventConcurrentModificationException
if an immutable empty list that has been returned more than once is being sorted in one thread and iterated through in another thread -- #334).- Type Parameters:
T
- the element type- Parameters:
list
- the list
-
sortIfNotEmpty
Sort a collection if it is not empty (to preventConcurrentModificationException
if an immutable empty list that has been returned more than once is being sorted in one thread and iterated through in another thread -- #334).- Type Parameters:
T
- the element type- Parameters:
list
- the listcomparator
- the comparator
-
sortCopy
Copy and sort a collection.- Parameters:
elts
- the collection to copy and sort- Returns:
- a sorted copy of the collection
-