|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hadoop.util.GenericsUtil
public class GenericsUtil
Contains utility methods for dealing with Java Generics.
Constructor Summary | |
---|---|
GenericsUtil()
|
Method Summary | ||
---|---|---|
static
|
getClass(T t)
Returns the Class object (of type Class<T> ) of the
argument of type T . |
|
static
|
toArray(Class<T> c,
List<T> list)
Converts the given List<T> to a an array of
T[] . |
|
static
|
toArray(List<T> list)
Converts the given List<T> to a an array of
T[] . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GenericsUtil()
Method Detail |
---|
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 class
Class<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 convert
ArrayIndexOutOfBoundsException
- if the list is empty.
Use toArray(Class, List)
if the list may be empty.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |