Java/Android - Search ArrayList<HashMap> for matching key -> value -



Java/Android - Search ArrayList<HashMap<String, String>> for matching key -> value -

i have arraylist of hashmaps, , have key , value of 1 hashmap i'd utilize match value of hashmap found @ different position..

for example:

1- [<key1, val1>, <key2, "some value">, <key3, val3>] 2- [<key1, val1>, <key2, val2>, <key3, val3>] 3- [<key1, "some value">, <key2, val2>, <key3, val3>]

and know array.get(1).get(key2) == "some value"

how can utilize match key1 @ array.position(2), , homecoming value of key3?

or in other words, how can find position of arraylist given value of 1 of it's containing key/value hashmaps?

something array.where("key1" == "some value").

thanks

you have brute-force way.

for(hashmap hm:hashmaparraylist) if(hm.get(key1).equal(yourdesirevalue) { //hm 1 need find out. }

java android

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -