Can someone help me solve my problem, how to create List<Map<Integer, List<MyType>> in while cycle. I'm selecting data from database and I'd like to add objects, that accomplish select's where condition into List and then put it into Map<Integer, List<MyType> where map key is in my case integer from database column order_num. Finally I would like to add all created maps into List. Method's return value is List<Map<Integer, List<MyType>>>.
Here's my part of source:
while (cursor.moveToNext) {
int id = cursor.getInt(cursor.getColumnIndex("item_id"));
int orderNum = cursor.getInt(cursor.getColumnIndex("order_num"));
String name = cursor.getString(cursor.getColumnIndex("item_name"));
list.add(new Item(id, orderNum, name);
}
now I'd like to add this list into Map where key is orderNum and value is List<Item>.