aspose file tools
The moose likes Java in General and the fly likes How can I get the values out of a Map and assign them each to their own String?(SOLVED) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "How can I get the values out of a Map and assign them each to their own String?(SOLVED)" Watch "How can I get the values out of a Map and assign them each to their own String?(SOLVED)" New topic
Author

How can I get the values out of a Map and assign them each to their own String?(SOLVED)

Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

edited to simplify:

I have this code:



which returns this:

no coordinates for this device
no coordinates for this device
{lng=20, lat=20}
no coordinates for this device

so as you can see my third device is the only one that has coordinates.

Now I need to take those values lng and lat, and assign them each to a String. So

String lng="20";
and
String lat="20"

but I cannot figure out how.

Ive tried things like String lat=x.get(0); but this returns a null value.

So how can I take the two values that are in my Map x, and assign them each to their own String?


solution

I needed to do x.get("lng"), not x.get(lng)

woohoo


True wisdom is in knowing you know nothing - Socrates
Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

edited out solved
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How can I get the values out of a Map and assign them each to their own String?(SOLVED)
 
Similar Threads
Trying to add string values to a list or some type of collection through iterator
consuming data from StreamHub Reverse Ajax & Comet Server via a servlet
Arrays
maps
Need to make empty text fields not pass null as the value, need them to just not pass anything