Code example for TreeSet

Methods: isEmptyfirst

     * @param context the context to use 
     * @param isNew if notify a new message comes, it should be true, otherwise, false. 
    public static void updateNewMessageIndicator(Context context, boolean isNew) {
        SortedSet<MmsSmsNotificationInfo> accumulator =
                new TreeSet<MmsSmsNotificationInfo>(INFO_COMPARATOR);
	MmsSmsDeliveryInfo delivery = null;
        Set<Long> threads = new HashSet<Long>(4);
        int count = 0;
        count += accumulateNotificationInfo(
                accumulator, getMmsNewMessageNotificationInfo(context, threads));
        count += accumulateNotificationInfo(
                accumulator, getSmsNewMessageNotificationInfo(context, threads));
        cancelNotification(context, NOTIFICATION_ID);
        if (!accumulator.isEmpty()) {
            accumulator.first().deliver(context, isNew, count, threads.size());
	// And deals with delivery reports (which use Toasts) 
	delivery = getSmsNewDeliveryInfo(context);
	if (delivery != null)