java - Converting Object[] into Hashmap -
i have function generate reports receives following arguments
public void generatereport(string[] headers, object[] data) i tried running following code
hashmap<string, string>[] hmap = (hashmap<string, string>[]) data; collection c = hmap.values(); iterator itr = c.iterator(); while(itr.hasnext()) system.out.println(itr.next()); output error:
cannot find symbol [error] symbol : method values() [error] location: class java.util.hashmap<java.lang.string,java.lang.string>[]
hmap array of hashmaps, not hashmap, has no values() method. need hmap[i].values() access values() of i'th hashmap in array.
Comments
Post a Comment