src/main/java/seedu/taskmanager/model/task/UniqueTaskList.java
/**
     * @param toAdd
     * @param addIndex
     * @return index deadline should be added in internalList according to
     *         chronological order
     */
@param toAdd
@param addIndex
@return index deadline should be added in internalList according to
chronological order
@param toAdd @param addIndex @return index deadline should be added in internalList according to chronological order
private int findSortedPositionToAddDeadlines(Task toAdd) {
        int addIndex = 0;
        while (internalList.get(addIndex).isEventTask()) {
            addIndex++;
            if (addIndex == internalList.size()) {
                break;
            }
        }
        while ((addIndex != internalList.size()) && internalList.get(addIndex).isDeadlineTask()) {
            if (isAddDeadlineEarlierAddListIndex(toAdd, internalList.get(addIndex))) {
                break;
            }
            addIndex++;
            if (addIndex == internalList.size()) {
                break;
            }
        }
        return addIndex;
    }
private int findSortedPositionToAddDeadlines ( Task toAdd ) { int addIndex = 0 ; while ( internalList . get ( addIndex ) . isEventTask ( ) ) { addIndex ++ ; if ( addIndex == internalList . size ( ) ) { break ; } } while ( ( addIndex != internalList . size ( ) ) && internalList . get ( addIndex ) . isDeadlineTask ( ) ) { if ( isAddDeadlineEarlierAddListIndex ( toAdd , internalList . get ( addIndex ) ) ) { break ; } addIndex ++ ; if ( addIndex == internalList . size ( ) ) { break ; } } return addIndex ; }
@param toAdd
 @param addIndex
 @return index deadline should be added in internalList according to
         chronological order
@param toAdd @param addIndex @return index deadline should be added in internalList according to chronological order