private synchronized void updateCueList() {
        if (!mCuesToAdd.isEmpty()) {
            Collections.sort(mCuesToAdd, mCueTimeSortComparator);

            int cuesToAddIndex = 0;
            ListIterator<Cue> iterator = mList.listIterator();

            // Add cues into list
            while(cuesToAddIndex < mCuesToAdd.size() && iterator.hasNext()) {
                Cue cue = iterator.next();
                if (cue.getTime() < mCuesToAdd.get(cuesToAddIndex).getTime()) {
                    iterator.add(mCuesToAdd.get(cuesToAddIndex));
                    cuesToAddIndex++;

                    int cueIndex = iterator.previousIndex();
                    if (cueIndex < mListPosition) {
                        mListPosition++;
                    }
                }
            }

            // Append remaining cues to end of list
            while(cuesToAddIndex < mCuesToAdd.size()) {
                iterator.add(mCuesToAdd.get(cuesToAddIndex));
                cuesToAddIndex++;
            }

            mCuesToAdd.clear();
        }

        if (!mCuesToRemove.isEmpty()) {
            HashSet<Cue> cuesToRemove = new HashSet<>(mCuesToRemove);

            int cuesToRemoveIndex = 0;
            ListIterator<Cue> iterator = mList.listIterator();

            while(cuesToRemoveIndex < mCuesToRemove.size() && iterator.hasNext()) {
                Cue cue = iterator.next();
                if (cuesToRemove.contains(cue)) {
                    iterator.remove();
                    cuesToRemoveIndex++;

                    int cueIndex = iterator.nextIndex();
                    if (cueIndex < mListPosition) {
                        mListPosition--;
                    }
                }
            }

            mCuesToRemove.clear();
        }

        mLastUpdateModCount = mModCount;

        // We possibly modified the cue list so we need to create a new iterator instance
        mListIterator = mList.listIterator(mListPosition);
    }
Resets the timeline to its initial empty state.
MediaPlayer/src/main/java/net/protyposis/android/mediaplayer/Timeline.java