Object[] to Class[] in Java -


Is there an built-in Java 6 method (perhaps in lung or reflection?) To perform:

  Private Sector [] Match Type (Last Object [] Objects) {Last Class [] Type = New Orbit [objects.length]; For (int i = 0; i objects lamps; i ++) {type [i] = objects [i] .getClass (); } Return type; }  

Which object takes the array and gives an array containing the type of each element?

No, there is no built-in facility for this in Javanese.

Not too heavy a burden, of course, it is easily unit-tested and only a few lines.

If you really want something, then you do not write yourself, the party library will do it for you (for example, Apache Commons Lang's classUtils , CGLIB's < Code> ReflectUtils ), so if you have one of these, you can use them.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -