0

I have the following ArrayList

ArrayList<HashMap<String, String>> list;
HashMap<String, String> map;

with the following values inside:

list[0] = map.put("key_0", value_0);
list[1] = map.put("key_1", value_1);
list[2] = map.put("key_2", value_2);

I would like to parse the list array and get the value of the key at a specific position.

0

1 Answer 1

3

You can get the particular map from the ArrayList> by using get() method. for example,

map = list.get(index);

And to get key of that map, you can do:

String key = map.get("key");

FYI, this is the feasible solution, i dont know why you are using key name like key_0, key_1, key_2...and so on.

Sign up to request clarification or add additional context in comments.

1 Comment

You're right. The key_names are all the same for each list item. Initially I meant writing it this way: list[0] = map("key_0", value_0, "key_1", value_1 etc. )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.