code: private void mergeSameDay(LinkedList<TimephasedCost> list)
     {
        LinkedList<TimephasedCost> result = new LinkedList<TimephasedCost>();
  
        TimephasedCost previousAssignment = null;
        for (TimephasedCost assignment : list)
        {
           if (previousAssignment == null)
           {
              assignment.setAmountPerDay(assignment.getTotalAmount());
              result.add(assignment);
           }
           else
           {
              Date previousAssignmentStart = previousAssignment.getStart();
              Date previousAssignmentStartDay = DateHelper.getDayStartDate(previousAssignmentStart);
              Date assignmentStart = assignment.getStart();
              Date assignmentStartDay = DateHelper.getDayStartDate(assignmentStart);
  
              if (previousAssignmentStartDay.getTime() == assignmentStartDay.getTime())
              {
                 result.removeLast();
  
                 double cost = previousAssignment.getTotalAmount().doubleValue();
                 cost += assignment.getTotalAmount().doubleValue();
  
                 TimephasedCost merged = new TimephasedCost();
                 merged.setStart(previousAssignment.getStart());
                 merged.setFinish(assignment.getFinish());
                 merged.setTotalAmount(Double.valueOf(cost));
                 assignment = merged;
              }
  
              assignment.setAmountPerDay(assignment.getTotalAmount());
              result.add(assignment);
           }
  
           previousAssignment = assignment;
        }
  
        list.clear();
        list.addAll(result);
     }
docs: This method merges together assignment data for the same day.
  
  @param list assignment data