Package org.opennms.core.utils
Class MutableCollections
- java.lang.Object
-
- org.opennms.core.utils.MutableCollections
-
public class MutableCollections extends java.lang.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> java.util.List<T>
copyListFromNullable(java.util.Collection<T> toCopy)
static <T> java.util.List<T>
copyListFromNullable(java.util.Collection<T> toCopy, java.util.function.Supplier<java.util.List<T>> listSupplier)
Copy a Collection to a List.static <T,S>
java.util.Map<T,S>copyMapFromNullable(java.util.Map<T,S> toCopy)
static <T,S>
java.util.Map<T,S>copyMapFromNullable(java.util.Map<T,S> toCopy, java.util.function.Supplier<java.util.Map<T,S>> mapSupplier)
Copy a Map.
-
-
-
Method Detail
-
copyListFromNullable
public static <T> java.util.List<T> copyListFromNullable(java.util.Collection<T> toCopy, java.util.function.Supplier<java.util.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> java.util.List<T> copyListFromNullable(java.util.Collection<T> toCopy)
-
copyMapFromNullable
public static <T,S> java.util.Map<T,S> copyMapFromNullable(java.util.Map<T,S> toCopy, java.util.function.Supplier<java.util.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
-
copyMapFromNullable
public static <T,S> java.util.Map<T,S> copyMapFromNullable(java.util.Map<T,S> toCopy)
-
-