配列リストにデータを追加しようとしています。この結果では
[{Store={id_store=2, namestore=Kupat Tahu Singaparna , product=[{id_product=1, price=100000, quantity=1}]}}]
このコードを使用できます:
static ArrayList Storecart = new ArrayList();
LinkedHashMap store = new LinkedHashMap();
LinkedHashMap storeitem = new LinkedHashMap();
LinkedHashMap listproduct = new LinkedHashMap();
ArrayList prdct = new ArrayList();
storeitem.put("id_store",id_store);
storeitem.put("namestore",namestr );
listproduct.put("id_product", id_prodt);
listproduct.put("price",priced);
listproduct.put("quantity", quantity);
prdct.add(listproduct);
storeitem.put("product", prdct);
store.put("Store", storeitem);
Storecart.add(store);
配列リスト内のオブジェクトのインデックスを取得する必要があります。問題は、「オブジェクトストアとオブジェクト製品を取得する」の配列リストをループしてすべてのインデックスを見つけることができないことです。最良で効率的な解決策は何でしょうか。