Class CollectionUtils
- java.lang.Object
-
- nonapi.io.github.classgraph.utils.CollectionUtils
-
public final class CollectionUtils extends java.lang.Object
Collection utilities.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
CollectionUtils()
Class can't be constructed.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends java.lang.Comparable<T>>
java.util.List<T>sortCopy(java.util.Collection<T> elts)
Copy and sort a collection.static <T extends java.lang.Comparable<? super T>>
voidsortIfNotEmpty(java.util.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(java.util.List<T> list, java.util.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).
-
-
-
Method Detail
-
sortIfNotEmpty
public static <T extends java.lang.Comparable<? super T>> void sortIfNotEmpty(java.util.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).- Type Parameters:
T
- the element type- Parameters:
list
- the list
-
sortIfNotEmpty
public static <T> void sortIfNotEmpty(java.util.List<T> list, java.util.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).- Type Parameters:
T
- the element type- Parameters:
list
- the listcomparator
- the comparator
-
sortCopy
public static <T extends java.lang.Comparable<T>> java.util.List<T> sortCopy(java.util.Collection<T> elts)
Copy and sort a collection.- Parameters:
elts
- the collection to copy and sort- Returns:
- a sorted copy of the collection
-
-