Does Class.getDeclaredFields() return members in a consistent order?
The documentation describes the method as:
The elements in the array returned are not sorted and are not in any
particular order
However I am not sure if this implies that the order will not be
consistent each time the application invokes the routine.
I am looking for a way to pair a unique ID for each field that is found -
but it also needs to be consistent with the next time the application is
run, i.e continuously generate the same ID.
I am wanting to just iterate over each Field found and increment a counter
per each element iterated. Then assign the ID of the particular element to
whatever the counter is equal to, these 'ids' aren't consistent though if
the Fields are not returned in a consistent order.
No comments:
Post a Comment