Code example for TreeSet

Methods: first, isEmpty

0
            printQueue(); 
        } 
    } 
 
    private void scheduleNext() { 
        if (stopped() || mEventQueue.isEmpty()) return;
 
        if (mPendingIntent != null) {
            throw new RuntimeException("pendingIntent is not null!");
        } 
 
        MyEvent event = mEventQueue.first();
        Intent intent = new Intent(getAction());
        intent.putExtra(TRIGGER_TIME, event.mTriggerTime);
        PendingIntent pendingIntent = mPendingIntent =
                PendingIntent.getBroadcast(mContext, 0, intent,
                        PendingIntent.FLAG_UPDATE_CURRENT);
        mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
                event.mTriggerTime, pendingIntent);
    }