Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Reflection getField() order

Reply
Thread Tools

Reflection getField() order

 
 
feng.hong@gmail.com
Guest
Posts: n/a
 
      06-13-2005
Does the Java language guarantee the order that the fields are returned
from getField()? It would be nice if the order that they are declared
in the classm is the order that getField() returns.(it is the case from
my sample test). However, is it garanteed? is there optimization that
would change the order?

Thanks.

 
Reply With Quote
 
 
 
 
John C. Bollinger
Guest
Posts: n/a
 
      06-13-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> Does the Java language guarantee the order that the fields are returned
> from getField()? It would be nice if the order that they are declared
> in the classm is the order that getField() returns.(it is the case from
> my sample test). However, is it garanteed? is there optimization that
> would change the order?


I presume you are talking about method Class.getFields(). From its
Javadocs: "The elements in the array returned are not sorted and are not
in any particular order." Thus no, the order is explicitly *not*
guaranteed.

--
John Bollinger
(E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reflection method name order Greg Willits Ruby 1 11-26-2008 07:41 AM
If you get an order # does it mean the order is accepted? =?Utf-8?B?U3RldmUxMDc3?= Windows 64bit 3 05-12-2005 11:46 PM
Traversion order cf. output order in XSL Soren Kuula XML 2 02-01-2004 09:10 AM
In which order are files looked for when loaded/requierd - and what'sthe order of suffixes? Stephan Kämper Ruby 2 01-18-2004 02:07 PM
How to Display DropDownList with preserved order (custom order) cspoh ASP .Net Web Controls 0 07-31-2003 09:19 AM



Advertisments