public class Generics extends Object
| Constructor and Description |
|---|
Generics() |
| Modifier and Type | Method and Description |
|---|---|
static <T> Class<T> |
cast(Class cls)
Returns a type-safe generic class of the given type-less class.
|
static <T> Collection<T> |
cast(Collection col)
Returns a type-safe generic collection of the given un-typed collection.
|
static <T> Enumeration<T> |
cast(Enumeration en)
Returns a type-safe generic enumeration of the given un-typed enumeration.
|
static <T> Iterator<T> |
cast(Iterator it)
Returns a type-safe generic iterator of the given un-typed iterator.
|
static <T> List<T> |
cast(List list)
Returns a type-safe generic list of the given un-typed list.
|
static <T> ListIterator<T> |
cast(ListIterator it)
Returns a type-safe generic list iterator of the given un-typed list iterator.
|
static <K,V> Map<K,V> |
cast(Map map)
Returns a type-safe generic map of the given un-typed map.
|
static <T> T |
cast(Object o)
Force to cast an object to the given type.
|
static <T> Set<T> |
cast(Set set)
Returns a type-safe generic set of the given un-typed set.
|
static <T> ThreadLocal<T> |
cast(ThreadLocal tl)
Returns a type-safe generic thread-local of the given un-typed thread-local.
|
public static final <T> Class<T> cast(Class cls)
public static final <T> T cast(Object o)
o
is an instance of T.public static final <T> Iterator<T> cast(Iterator it)
public static final <T> ListIterator<T> cast(ListIterator it)
public static final <T> Enumeration<T> cast(Enumeration en)
public static final <T> Collection<T> cast(Collection col)
public static final <T> List<T> cast(List list)
public static final <T> Set<T> cast(Set set)
public static final <K,V> Map<K,V> cast(Map map)
public static final <T> ThreadLocal<T> cast(ThreadLocal tl)
Copyright © 2018. All rights reserved.