ArrayList Hashmap getValue

Put your problem here if it does not fit any of the other categories.

ArrayList Hashmap getValue

Postby bacarni » Fri Jan 14, 2011 12:08 pm

Hello,
I'm trying to get values out of my ArrayList.
With
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. result.get(groupPosition).toString()
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

I get the following
Code: Select all
[{tableName=ThermoVerstaendnis, cardName=Verstaendnis}, {tableName=ThermoZahlen, cardName=Zahlen}]


But now I have no clue to catch these values...
bacarni
Freshman
Freshman
 
Posts: 2
Joined: Tue Nov 23, 2010 5:32 pm

Top

Re: ArrayList Hashmap getValue

Postby Jems » Fri Jan 14, 2011 1:06 pm

If your ArrayList contains objects of type MyClass, then just do:
MyClass o = result.get(groupPosition);
Then access the data using whatever methods/fields are provided by o.
Jems
Experienced Developer
Experienced Developer
 
Posts: 57
Joined: Thu Dec 09, 2010 7:42 pm

Re: ArrayList Hashmap getValue

Postby bacarni » Fri Jan 14, 2011 1:27 pm

It was not a Class, but it was an <ArrayList<ArrayList<HashMap>>>. So I just turned everything around and now I can access my values in the HashMap.

Thanks for your help. You poked me to the right way.
bacarni
Freshman
Freshman
 
Posts: 2
Joined: Tue Nov 23, 2010 5:32 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 16 guests