java - How to retrieve object stored in map value? -


set<entry<integer, inventorystock>> inventorydata= set<map.entry<integer,inventorystock>>) ois.readobject();   for( entry<integer, inventorystock> list:inventorydata) {              for(inventorystock stock:list)              if(stock!=null){             system.out.println("item id" + stock.getitemid()+"  "+stock);              map.putifabsent(stock.getitemid(), stock);               }  

i picking inventorydata set .ser file , need access values of map (which inventorystock objects) , need assign map. showing error @ second enhanced loop:

error: can iterate on array or instance of java.lang.iterable in 2nd loop

please me fix code!

you can not iterate entry. entry pair of (key, value), (singular) inventorystock entry, have use getvalue.

for( entry<integer, inventorystock> entry : inventorydata) {     inventorystock stock = entry.getvalue();     if (stock != null) {         ... 

Comments

Popular posts from this blog

symfony - TEST environment only: The database schema is not in sync with the current mapping file -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -