Top Description Constructors Methods
nonapi.io.github.classgraph.utils

public final Class CollectionUtils

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collection, .Collections, .Comparator, .ConcurrentModificationException, .List

Collection utilities.

Constructor Summary

AccessConstructor and Description
private
CollectionUtils()

Class can't be constructed.

Method Summary

Modifier and TypeMethod and Description
public static <T extends Comparable<T>> List<T>

Returns:

a sorted copy of the collection
sortCopy
(final Collection<T>
the collection to copy and sort
elts
)

Copy and sort a collection.

public static <
the element type
T extends Comparable<? super T>
>
void
sortIfNotEmpty(final List<T>
the list
list
)

Sort a collection if it is not empty (to prevent ConcurrentModificationException 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).

public static <
the element type
T
>
void
sortIfNotEmpty(final List<T>
the list
list
,
final Comparator<? super T>
the comparator
comparator
)

Sort a collection if it is not empty (to prevent ConcurrentModificationException 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).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CollectionUtilsback to summary
private CollectionUtils()

Class can't be constructed.

Method Detail

sortCopyback to summary
public static <T extends Comparable<T>> List<T> sortCopy(final Collection<T> elts)

Copy and sort a collection.

Parameters
elts:Collection<T>

the collection to copy and sort

Returns:List<T>

a sorted copy of the collection

sortIfNotEmptyback to summary
public static <T extends Comparable<? super T>> void sortIfNotEmpty(final List<T> list)

Sort a collection if it is not empty (to prevent ConcurrentModificationException 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).

Parameters
<T>
the element type
list:List<T>

the list

sortIfNotEmptyback to summary
public static <T> void sortIfNotEmpty(final List<T> list, final Comparator<? super T> comparator)

Sort a collection if it is not empty (to prevent ConcurrentModificationException 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).

Parameters
<T>
the element type
list:List<T>

the list

comparator:Comparator<? super T>

the comparator