Java Class java.lang.reflect.Array provides a set of tools for creating an array dynamically. However in addition to that it has a whole set of methods for accessing (get, set,
These methods relieve you from the burden of checking and casting the array yourself, if all you know is "that object is an array of some (possibly primitive) type".
I myself have seen uses of this only in frameworks and utilities, like commons-beanutils
. This framework reflectively accesses properties of java beans, and uses the Array
methods to access elements of array properties.