public final class Utils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> List<T> |
immutable(List<T> list,
Supplier<List<T>> listSupplier)
Returns an immutable
List . |
static <K,V> Map<K,V> |
immutableMap(Map<K,V> map,
Supplier<Map<K,V>> supplier)
Creates an immutable
Map . |
public static <T> List<T> immutable(List<T> list, Supplier<List<T>> listSupplier)
List
.T
- The type of elements of this list.list
- The original list to copy.listSupplier
- A function which returns a new empty List
into which the results will be inserted.public static <K,V> Map<K,V> immutableMap(Map<K,V> map, Supplier<Map<K,V>> supplier)
Map
.
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 your immutableMap
K
- Key type of the Map
.V
- Value type of the Map
.map
- The original map to copy.supplier
- A function which returns a new empty Map
into which the results will be inserted.Map
.Copyright 2011-2017 ForgeRock AS.