Converts the specified object to an array according to the following rules:
obj
is already an array object
(i.e. instance of java.lang.Object[]
),
the function works simply as the type cast operator,
same as it would be in Java: (Object[]) obj
obj
is an instance of java.util.Collection
Java class
(which also includes vectors),
the returned array is created as: ((Collection) obj).toArray()
obj
is an enumeration
(i.e. instance of java.util.Enumeration
),
the function returns an array produced from the enumeration's elements.
obj
is an instance of java.util.Iterator
Java class,
the function returns an array containing all elements provided by the iterator.
obj
is an instance of java.util.Map
Java class,
the returned array is created as: ((Map) obj).values().toArray()
obj
is null
, an empty array is returned.
obj
is neither of the above, the function returns
a single-element array with this object as the only element.
You may call this function in a more method-like style:
obj.toArray()