Code example for SortedSet

Methods: contains, first, isEmpty, tailSet

0
        if (valueSet == null)
        { 
            return startValue;
        } 
 
        if (valueSet.contains(startValue))
        { 
            return startValue;
        } 
 
        SortedSet<Integer> tailSet = valueSet.tailSet(startValue + 1);
 
        if (tailSet.isEmpty())
        { 
            return -1; 
        } 
        else 
        { 
            return tailSet.first();
        } 
    } 
 
    private static int getTimeYYYYMMDD(Calendar calendar) {
        return 10000*calendar.get(Calendar.YEAR) + (calendar.get(Calendar.MONTH) + 1) * 100 + calendar.get(Calendar.DAY_OF_MONTH);