Package org.forgerock.openig.tools
Class Utils
- java.lang.Object
-
- org.forgerock.openig.tools.Utils
-
public final class Utils extends Object
Utility class.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> List<T>
immutable(List<T> list, Supplier<List<T>> listSupplier)
Returns an immutableList
.static <K,V>
Map<K,V>immutableMap(Map<K,V> map, Supplier<Map<K,V>> supplier)
Creates an immutableMap
.static List<Throwable>
throwableCauses(Throwable throwable)
-
-
-
Method Detail
-
immutable
public static <T> List<T> immutable(List<T> list, Supplier<List<T>> listSupplier)
Returns an immutableList
.- Type Parameters:
T
- The type of elements of this list.- Parameters:
list
- The original list to copy.listSupplier
- A function which returns a new emptyList
into which the results will be inserted.- Returns:
- An immutable list of strings.
-
immutableMap
public static <K,V> Map<K,V> immutableMap(Map<K,V> map, Supplier<Map<K,V>> supplier)
Creates an immutableMap
.Note: This method uses a reference for the value. If the map value is not a primitive type, such as a list of strings, you may consider using
.immutable
method before creating yourimmutableMap
- Type Parameters:
K
- Key type of theMap
.V
- Value type of theMap
.- Parameters:
map
- The original map to copy.supplier
- A function which returns a new emptyMap
into which the results will be inserted.- Returns:
- An immutable
Map
.
-
-