public class Immutables extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Immutables.Immutable |
Constructor and Description |
---|
Immutables() |
Modifier and Type | Method and Description |
---|---|
static <T> Collection<T> |
immutableCollectionCopy(Collection<? extends T> collection)
Creates a new immutable copy of the specified Collection.
|
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<? extends 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<? extends K,? extends 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<? extends 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 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<? extends T> list)
list
- the list 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<? extends 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<? extends K,? extends V> map)
map
- the map to copy frompublic static <T> Collection<T> immutableCollectionCopy(Collection<? extends T> collection)
collection
- the collection to copyCopyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.