Class UnmodifiableCollectionUtil
java.lang.Object
com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil
Note: it simply wraps the existing JDK methods to provide a workaround
 for Pitest survival on mutation for removal of immutable wrapping,
 see #13127 for more details.
 
- 
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePrivate constructor for UnmodifiableCollectionUtil. - 
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T[]copyOfArray(T[] array, int length) Creates a copy of array.static <K,V> Map<K, V> Creates a copy of Map.static <T> Set<T>singleton(T obj) Returns an immutable set containing only the specified object.static <S,T> List<T> unmodifiableList(Collection<S> items, Class<T> elementType) Returns an unmodifiable view of a List containing elements of a specific type.static <T> List<T>unmodifiableList(List<T> collection) Creates an unmodifiable list based on the provided collection. 
- 
Constructor Details
- 
UnmodifiableCollectionUtil
private UnmodifiableCollectionUtil()Private constructor for UnmodifiableCollectionUtil. 
 - 
 - 
Method Details
- 
unmodifiableList
Creates an unmodifiable list based on the provided collection.- Type Parameters:
 T- the type of elements in the set- Parameters:
 collection- the collection to create an unmodifiable list from- Returns:
 - an unmodifiable list containing the elements from the provided collection
 
 - 
unmodifiableList
Returns an unmodifiable view of a List containing elements of a specific type.- Type Parameters:
 S- The generic type of elements in the input Collection.T- The type of elements in the resulting unmodifiable List.- Parameters:
 items- The List of items to make unmodifiable.elementType- The Class object representing the type of elements in the list.- Returns:
 - An unmodifiable List containing elements of the specified type.
 
 - 
copyOfArray
Creates a copy of array.- Type Parameters:
 T- The type of array- Parameters:
 array- Array to create a copy oflength- length of array- Returns:
 - copy of array
 
 - 
copyOfMap
Creates a copy of Map.- Type Parameters:
 K- the type of keys in the mapV- the type of values in the map- Parameters:
 map- map to create a copy of- Returns:
 - an immutable copy of the input map
 
 - 
singleton
Returns an immutable set containing only the specified object.- Type Parameters:
 T- the type of object- Parameters:
 obj- the type of object in the set- Returns:
 - immutable set
 
 
 -