Hello, and my apologies if this topic has been covered (I didn't find
anything from a handful of searches on Android Beginners!). I read in
the "Designing for Performance" guide that:
"An array of ints is a much better than an array of Integers, but this
also generalizes to the fact that two parallel arrays of ints are also
a lot more efficient than an array of (int,int) objects. The same goes
for any combination of primitive types."

Which makes sense to me. However, in my particular project, I receive
a JSON object (hash) of data from the web, and need to display this
data on an Android phone in key-sorted order. In this case, I can't
think of an easy way to maintain parallelism between the two arrays
while sorting the keys alphabetically. I could reinvent the wheel and
write a search which modifies both arrays at once I guess, but that
sets off red flags for me that there must be a better way.

Should I just take the hit and implement this as a single array of
(String, int) (aka key, value) objects? Is there a way that I can
somehow sort the keys prior to building my array from the JSON hash
object?

Any ideas or input would be much appreciated!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to