ArrayUtilities

public final class ArrayUtilities

ArrayUtilities is a convenient class for handling some common array processing.

Author:Hugo Y. K. Lam

Methods

forNames

public static Class[] forNames(String[] classNames)

Returns the Class object array associated with the class or interface with the given string name array.

Parameters:
  • classNames – the fully qualified names of the desired classes.
Throws:
Returns:

the Class object array for the classes with the specified names.

forObjects

public static Class[] forObjects(Object[] objs)

Returns the Class object array associated with the class or interface with the given object array.

Parameters:
  • objs – the objects of the desired classes.
Returns:

the Class object array for the classes with the specified objects.

toArray

public static String[] toArray(String s, String delim)

Tokenizes a string by the specified delimiter(s) and converts it into a string array.

Parameters:
  • s – the string to be tokenized.
  • delim – the delimiter(s).
Returns:

the tokenized strings as a string array.

toArray

public static Object[] toArray(Iterator it)

Converts an iterator into an object array.

Parameters:
  • it – the iterator to be converted.
Returns:

an array representation of the iterator.

toArray

public static Object[] toArray(Iterator it, Object[] a)

Converts an iterator into an object array.

Parameters:
  • it – the iterator to be converted.
  • a – the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
Returns:

an array representation of the iterator.

toArray

public static Object[] toArray(Enumeration enumeration)

Converts an enumeration into an object array.

Parameters:
  • enumeration – the enumeration to be converted.
Returns:

an array representation of the enumeration.

toArray

public static Object[] toArray(Enumeration enumeration, Object[] a)

Converts an enumeration into an object array.

Parameters:
  • enumeration – the enumeration to be converted.
  • a – the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
Returns:

an array representation of the enumeration.

toClasses

public static Class[] toClasses(Object[] objs)