Code example for TreeSet

Methods: first, isEmpty

0
     * @param context the context to use 
     * @param isNew if notify a new message comes, it should be true, otherwise, false. 
     */ 
	public static void blockingUpdateNewMessageIndicator(Context context, boolean isNew) {
        SortedSet<OmacpNotificationInfo> accumulator =
                new TreeSet<OmacpNotificationInfo>(INFO_COMPARATOR);
        Set<Long> threads = new HashSet<Long>(4);
        int count = 0;
        count += accumulateNotificationInfo(
                accumulator, getOmacpNewMessageNotificationInfo(context));
 
        cancelNotification(context, NOTIFICATION_ID);
        if (!accumulator.isEmpty()) {
            accumulator.first().deliver(context, isNew, count, threads.size());
        } 
    } 
	 
	public static void updateAllNotifications(Context context){
		nonBlockingUpdateNewMessageIndicator(context, false);
	}