public class GenericsUtil extends Object
构造器和说明 |
---|
GenericsUtil() |
限定符和类型 | 方法和说明 |
---|---|
static <T> Class<T> |
getClass(T t)
Returns the Class object (of type
Class<T> ) of the
argument of type T . |
static <T> T[] |
toArray(Class<T> c,
List<T> list)
Converts the given
List<T> to a an array of
T[] . |
static <T> T[] |
toArray(List<T> list)
Converts the given
List<T> to a an array of
T[] . |
public static <T> Class<T> getClass(T t)
Class<T>
) of the
argument of type T
.T
- The type of the argumentt
- the object to get it classClass<T>
public static <T> T[] toArray(Class<T> c, List<T> list)
List<T>
to a an array of
T[]
.c
- the Class object of the items in the listlist
- the list to convertpublic static <T> T[] toArray(List<T> list)
List<T>
to a an array of
T[]
.list
- the list to convertArrayIndexOutOfBoundsException
- if the list is empty.
Use toArray(Class, List)
if the list may be empty.Copyright © 2009 The Apache Software Foundation