public class TypedCollections extends Object
Constructor and Description |
---|
TypedCollections() |
Modifier and Type | Method and Description |
---|---|
static <E,TypedC extends Collection<E>> |
dynamicallyCastCollection(Collection<?> c,
Class<E> type,
Class<TypedC> collectionType)
Dynamically check that the members of the collection are all instances of the given type (or
null), and that the collection itself is of the given collection type.
|
static <E> List<E> |
dynamicallyCastList(List<?> list,
Class<E> type)
Dynamically check that the members of the list are all instances of the given type (or null).
|
static <K,V> Map<K,V> |
dynamicallyCastMap(Map<?,?> map,
Class<K> keyType,
Class<V> valueType)
Dynamically check that the keys and values in the map are all instances of the correct types
(or null).
|
static <E> Set<E> |
dynamicallyCastSet(Set<?> set,
Class<E> type)
Dynamically check that the members of the set are all instances of the given type (or null).
|
public static <E,TypedC extends Collection<E>> TypedC dynamicallyCastCollection(Collection<?> c, Class<E> type, Class<TypedC> collectionType)
E
- the collection's element typec
- the collection to casttype
- the class of the collection's element type.ClassCastException
public static <E> List<E> dynamicallyCastList(List<?> list, Class<E> type)
E
- the list's element typelist
- the list to casttype
- the class of the list's element type.ClassCastException
public static <E> Set<E> dynamicallyCastSet(Set<?> set, Class<E> type)
E
- the set's element typeset
- the set to casttype
- the class of the set's element type.ClassCastException
public static <K,V> Map<K,V> dynamicallyCastMap(Map<?,?> map, Class<K> keyType, Class<V> valueType)
K
- the map's key typeV
- the map's value typemap
- the map to castkeyType
- the class of the map's key type.valueType
- the class of the map's value type.ClassCastException
Comments to: faces-dev@eclipse.org.
Copyright © 2019 Eclipse Foundation. All rights reserved.
Use is subject to license terms.