Package org.opennms.core.utils
Class MutableCollections
- java.lang.Object
-
- org.opennms.core.utils.MutableCollections
-
public class MutableCollections extends Object
Convenience Methods for handling mutable Collections.- Author:
- mbrooks
-
-
Constructor Summary
Constructors Constructor Description MutableCollections()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> List<T>
copyListFromNullable(Collection<T> toCopy)
static <T> List<T>
copyListFromNullable(Collection<T> toCopy, java.util.function.Supplier<List<T>> listSupplier)
Copy a Collection to a List.static <T,S>
Map<T,S>copyMapFromNullable(Map<T,S> toCopy)
static <T,S>
Map<T,S>copyMapFromNullable(Map<T,S> toCopy, java.util.function.Supplier<Map<T,S>> mapSupplier)
Copy a Map.
-
-
-
Method Detail
-
copyListFromNullable
public static <T> List<T> copyListFromNullable(Collection<T> toCopy, java.util.function.Supplier<List<T>> listSupplier)
Copy a Collection to a List.- Parameters:
toCopy
- the Collection to copylistSupplier
- the supplier for the desired List type- Returns:
- a new List containing the same elements as the given Collection
-
copyListFromNullable
public static <T> List<T> copyListFromNullable(Collection<T> toCopy)
-
copyMapFromNullable
public static <T,S> Map<T,S> copyMapFromNullable(Map<T,S> toCopy, java.util.function.Supplier<Map<T,S>> mapSupplier)
Copy a Map.- Parameters:
toCopy
- the Map to copymapSupplier
- the supplier for the desired Map type- Returns:
- a new Map containing the same elements as the given Map
-
-