Simplified a section of code for total price by store (used HashMap to access header section)

This commit is contained in:
Aaron Sun 2020-10-25 16:15:42 -07:00
parent 8afa81db59
commit 7bc43d8249

View File

@ -100,11 +100,7 @@ public class ListPage extends AppCompatActivity {
pListItemPair.add(entry);
}
else {
int index = 0;
while(index < pNames.size() && !pNames.get(index).equals("Kroger")) {
index++;
}
int index = storeHeaderIndex.get("Kroger");
totalPriceByStore.put("Kroger", totalPriceByStore.get("Kroger") + (item.getPrice().doubleValue() * entry.getQuantity()));
pPrices.set(index, totalPriceByStore.get("Kroger").toString());