Code example for NavigableSet

Methods: headSet

0
     
    @SuppressWarnings("unchecked") 
    protected static SortedSet<String> headSetInclusive(SortedSet<String> set, String input) {
        // use NavigableSet inclusive version if available 
        if(set instanceof NavigableSet) {
            return ((NavigableSet)set).headSet(input, true);
        } 
        // use Stored*Set inclusive version if available 
        if(set instanceof StoredSortedKeySet) {
            return ((StoredSortedKeySet)set).headSet(input, true);
        } 
        if(set instanceof StoredSortedValueSet) {
            return ((StoredSortedValueSet)set).headSet(input, true);
        } 
        // Use synthetic "one above" trick 
        // NOTE: because '\0' sorts in the middle in "java modified UTF-8", 
        // used in the Stored* class StringBindings, this trick won't work 
        // there 
        return set.headSet(input+'\0');
    } 
Contextual code suggestions in your IDE  Get Codota for Java