Advertisement
stevekamau

Untitled

Oct 23rd, 2016
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.05 KB | None | 0 0
  1.   String hour = getTimeFormattedInAMPM(sale_obj.getString("created_at"));
  2.                         // 1
  3.                         int index = Collections.singletonList(sales_labels_1).indexOf(hour);
  4.                         int count = 1;
  5.                         if(index < 0){ // hour doesnt exist in sales_label_1
  6.                             sales_labels_1.add(hour);
  7.                             index = 0; // overwrite index
  8.                             Log.d("index_if", String.valueOf(index));
  9.                         }
  10.                         else {
  11.                             Log.d("index_else", String.valueOf(index));
  12.                             int current_count = groupedSales.getInt(hour); // read the current count
  13.                             count = Integer.valueOf(current_count) + 1; // increment by 1
  14.                         }
  15.                         Log.d("index_final", String.valueOf(index));
  16.                         groupedSales.put(hour, count);
  17.                         sales_values_1.add(new Entry(Float.valueOf(String.valueOf(count)), index));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement