Advertisement
stevekamau

Untitled

Oct 24th, 2016
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1.                     String productName = sale_obj.getString("name");
  2.                     double total = sale_obj.getDouble("price");
  3.                     int index = product_labels_1.indexOf(productName);
  4.                     if (index < 0) {
  5.                         // product doesnt exist in product_labels_1
  6.                         product_labels_1.add(productName);
  7.                         product_values_1.add(new Entry((float) total, product_labels_1.size() - 1));
  8.                     } else {
  9.                         // read the current total
  10.                         int current_total = (int) groupedProducts.getDouble(productName);
  11.                         // increment by the total
  12.                         total = current_total + total;
  13.                         product_values_1.set(index, new Entry((float) total, index));
  14.                     }
  15.                     groupedProducts.put(productName, total);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement