android - Java: Correct Iterating through types -


"1", "short_name": "1", "type": [ "<"> < ">" "ABC Street", "typing": [ "path"]}, { "lamganama": "ABC Town" "laghunama": "ABC Street", "ABC", "type": [ "localism", "political"]}, { "lambenama": "ABC zone", "laghunama": "ABCL", "type" : [ "prasasanikareyalevala2", "political"]}, "", "sortanama": "CT", "sortanama": "country," "sortanama": "ABC L", "sortanama": "ABCL", "type ": [" Administrative_Re_Leal_1 "," Political "]},", "Type": ["Country", "Political"}}, " Mganama ":" 1234 "," laghunama ":" 1234 "," type ": [" postal_code "]}

I have this JSON with Google Maps and it successfully a jiesaoena object Has changed into:

  class address_component {public string long_name; public string short_name; public string [] type;}   

How should I repeat through the medium? I need to save the road, fault number and city in my own area. I It was thought that the area is only one thing to do, but I do not see the right:

  if (types.contains ( "street_number")) {street_number = short_name} else if (Types.contains ("Route")) {street = short_name}   

And of course looping through each address_component. How can I do this better?

type arrays are one or two records long, and you only have three Looking for data types. There is some wasted effort in your approach, but in it (string) object does not waste too much effort in its current form because the number is so small.

To make a clear way to avoid unnecessary work, go ahead in the ("road") check after you get the road, and for other areas too. This may be a simple additional condition:

  if (null == galimmbara and amp; amp; amp; and amp; types.contains ( "street_number")) {street_number = short_name} and If (street == tap & amp;; & amp;; amp; types.contains ("route")) {street = short_name}   

to tell you what you are doing in the big picture You have not posted enough code, you are asking about the I-if-contain-else-if-contains section, there are two potential problems with a very large cost.

  1. You can record the address type when searching for seven of these (or more) data. Once you have three things you need and what to leave, but there may be more types of address?
  2. Does your code load the entire JSON structure in memory before you start processing or does it take a streaming approach?
  3. The big whopper is a good look at the API's documentation which you are asking if there is a way to tell the server what kind of data you are looking for, then the server Filter something that you do not need to get out of feedback. You will still be iterative, but you will not delete so many data. It saves bandwidth, memory and CPU on mobile device. The server has a lot of these, so it's best to let it work.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -