Package org.infinispan.commons.util
Class Immutables
java.lang.Object
org.infinispan.commons.util.Immutables
- Direct Known Subclasses:
CoreImmutables
Factory for generating immutable type wrappers.
- Since:
- 4.0
- Author:
- Jason T. Greene, Galder ZamarreƱo, Tristan Tarrant
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static class
static class
static class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ImmutableListCopy
<T> immutableListAdd
(List<T> list, int position, T element) static <T> List
<T> immutableListConvert
(Collection<? extends T> source) Converts a Collection to an immutable List by copying it.static <T> List
<T> immutableListRemove
(List<T> list, int position) static <T> ImmutableListCopy
<T> immutableListReplace
(List<T> list, int position, T element) static <T> List
<T> immutableListWrap
(T... array) Wraps an array with an immutable list.static <K,
V> Map <K, V> immutableMapWrap
(Map<? extends K, ? extends V> map) Wraps a map with an immutable map.static <T> Set
<T> immutableSetWrap
(Set<? extends T> set) Wraps a set with an immutable set.static TypedProperties
immutableTypedProperties
(TypedProperties properties) Creates an immutable copy of the properties.
-
Constructor Details
-
Immutables
public Immutables()
-
-
Method Details
-
immutableListConvert
Converts a Collection to an immutable List by copying it.- Parameters:
source
- the collection to convert- Returns:
- a copied/converted immutable list
-
immutableTypedProperties
Creates an immutable copy of the properties.- Parameters:
properties
- the TypedProperties to copy- Returns:
- the immutable copy
-
immutableListWrap
Wraps an array with an immutable list. There is no copying involved.- Parameters:
array
- the array to wrap- Returns:
- a list containing the array
-
immutableListAdd
-
immutableListReplace
-
immutableListRemove
-
immutableSetWrap
Wraps a set with an immutable set. There is no copying involved.- Parameters:
set
- the set to wrap- Returns:
- an immutable set wrapper that delegates to the original set
-
immutableMapWrap
Wraps a map with an immutable map. There is no copying involved.- Parameters:
map
- the map to wrap- Returns:
- an immutable map wrapper that delegates to the original map
-