GenericsUtil (Hadoop 1.2.1 API)
Date: 2013-07-22

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.util
Class GenericsUtil

    java.lang.Object
      org.apache.hadoop.util.GenericsUtil

    public class GenericsUtil

extends Object

Contains utility methods for dealing with Java Generics.

Constructor Summary
`GenericsUtil()`

Method Summary
`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[]`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GenericsUtil

    public GenericsUtil()

Method Detail

### getClass

    public static <T> Class<T> getClass(T t)

  Returns the Class object (of type `Class<T>`) of the argument of type `T`.

  Type Parameters:
    `T` - The type of the argument
  Parameters:
    `t` - the object to get it class
  Returns:
    `Class<T>`

### toArray

    public static <T> T[] toArray(Class<T> c,
                                  List<T> list)

  Converts the given `List<T>` to a an array of `T[]`.

  Parameters:
    `c` - the Class object of the items in the list
    `list` - the list to convert

### toArray

    public static <T> T[] toArray(List<T> list)

  Converts the given `List<T>` to a an array of `T[]`.

  Parameters:
    `list` - the list to convert
  Throws:
    `ArrayIndexOutOfBoundsException` - if the list is empty. Use `toArray(Class, List)` if the list may be empty.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation