Why Use java.lang.reflect.Array For Anything Other Than Array Creation?

Posted by dimo414 on Stack Overflow See other posts from Stack Overflow or by dimo414
Published on 2010-05-27T19:48:44Z Indexed on 2010/05/27 19:51 UTC
Read the original article Hit count: 169

Filed under:
|
|

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, and length) an array. I don't understand the point of this, since you can (and presumably would) cast your dynamically generated array as an array upon creation, which means you can use the normal array access (bracket notation) functionality. In fact, looking at the source code you can see that is all the class does, cast the array, and throw an exception if the cast fails.

So what's the point / usefulness of all of these extra methods?

© Stack Overflow or respective owner

Related posts about java

Related posts about arrays