Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String hour = getTimeFormattedInAMPM(sale_obj.getString("created_at"));
- // 1
- int index = Collections.singletonList(sales_labels_1).indexOf(hour);
- int count = 1;
- if(index < 0){ // hour doesnt exist in sales_label_1
- sales_labels_1.add(hour);
- index = 0; // overwrite index
- Log.d("index_if", String.valueOf(index));
- }
- else {
- Log.d("index_else", String.valueOf(index));
- int current_count = groupedSales.getInt(hour); // read the current count
- count = Integer.valueOf(current_count) + 1; // increment by 1
- }
- Log.d("index_final", String.valueOf(index));
- groupedSales.put(hour, count);
- sales_values_1.add(new Entry(Float.valueOf(String.valueOf(count)), index));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement