public class Immutables extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Immutables.Immutable |
static class |
Immutables.ImmutableMapWrapperExternalizer |
Constructor and Description |
---|
Immutables() |
Modifier and Type | Method and Description |
---|---|
static <T> Collection<T> |
immutableCollectionCopy(Collection<T> collection)
Creates a new immutable copy of the specified Collection.
|
static <T> Collection<T> |
immutableCollectionWrap(Collection<? extends T> collection)
Wraps a collection with an immutable collection.
|
static <K,V> Map.Entry<K,V> |
immutableEntry(Map.Entry<K,V> entry)
Wraps a
Map.Entry } with an immutable Map.Entry }. |
static InternalCacheEntry |
immutableInternalCacheEntry(InternalCacheEntry entry)
Wraps a
InternalCacheEntry } with an immutable InternalCacheEntry }. |
static <T> List<T> |
immutableListConvert(Collection<? extends T> source)
Converts a Collection to an immutable List by copying it.
|
static <T> List<T> |
immutableListCopy(List<T> list)
Creates an immutable copy of the list.
|
static <T> List<T> |
immutableListMerge(List<? extends T> list1,
List<? extends T> list2)
Creates a new immutable list containing the union (combined entries) of both lists.
|
static <T> List<T> |
immutableListWrap(T... array)
Wraps an array with an immutable list.
|
static <K,V> Map<K,V> |
immutableMapCopy(Map<K,V> map)
Creates an immutable copy of the specified map.
|
static <K,V> Map<K,V> |
immutableMapWrap(Map<? extends K,? extends V> map)
Wraps a map with an immutable map.
|
static <T> Set<T> |
immutableSetConvert(Collection<? extends T> collection)
Converts a Collections into an immutable Set by copying it.
|
static <T> Set<T> |
immutableSetCopy(Set<T> set)
Creates an immutable copy of the specified set.
|
static <T> Set<T> |
immutableSetWrap(Set<? extends T> set)
Wraps a set with an immutable set.
|
static TypedProperties |
immutableTypedPropreties(TypedProperties properties)
Creates an immutable copy of the properties.
|
static boolean |
isImmutable(Object o)
Whether or not this collection type is immutable
|
public static boolean isImmutable(Object o)
o
- a Collection, Set, List, or Mappublic static <T> List<T> immutableListConvert(Collection<? extends T> source)
source
- the collection to convertpublic static <T> List<T> immutableListCopy(List<T> list)
list
- the list to copypublic static TypedProperties immutableTypedPropreties(TypedProperties properties)
properties
- the TypedProperties to copypublic static <T> List<T> immutableListWrap(T... array)
T
- array
- the array to wrappublic static <T> List<T> immutableListMerge(List<? extends T> list1, List<? extends T> list2)
list1
- contains the first elements of the new listlist2
- contains the successor elements of the new listpublic static <T> Set<T> immutableSetConvert(Collection<? extends T> collection)
collection
- the collection to convert/copypublic static <T> Set<T> immutableSetWrap(Set<? extends T> set)
set
- the set to wrappublic static <T> Set<T> immutableSetCopy(Set<T> set)
set
- the set to copy frompublic static <K,V> Map<K,V> immutableMapWrap(Map<? extends K,? extends V> map)
map
- the map to wrappublic static <K,V> Map<K,V> immutableMapCopy(Map<K,V> map)
map
- the map to copy frompublic static <T> Collection<T> immutableCollectionCopy(Collection<T> collection)
collection
- the collection to copypublic static <T> Collection<T> immutableCollectionWrap(Collection<? extends T> collection)
collection
- the collection to wrappublic static <K,V> Map.Entry<K,V> immutableEntry(Map.Entry<K,V> entry)
Map.Entry
} with an immutable Map.Entry
}. There is no copying involved.entry
- the mapping to wrap.Map.Entry
} wrapper that delegates to the original mapping.public static InternalCacheEntry immutableInternalCacheEntry(InternalCacheEntry entry)
InternalCacheEntry
} with an immutable InternalCacheEntry
}. There is no copying involved.entry
- the internal cache entry to wrap.InternalCacheEntry
} wrapper that delegates to the original entry.Copyright © 2012 JBoss by Red Hat. All Rights Reserved.