TreeSet floor - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for TreeSet floor method.

This code example shows how to use the following methods:add, ceiling, floor
package ru.antonevane.ch7; 
 
import java.util.SortedMap; 
import java.util.TreeMap; 
import java.util.TreeSet; 
 
public class Navigatable { 
 
	public static void main(String[] args) {
		TreeSet<Integer> times = new TreeSet<Integer>();
		times.add(1545);
		times.add(1645);
		times.add(1945);
		 
 
		System.out.println(times.floor(1644));
		System.out.println(times.ceiling(1644));
 
		TreeMap<String, String> map = new TreeMap<String, String>();
		map.put("a", "ant");

6
CodeRank
This code example shows how to use the following methods:floor
		this.exclusions = exclusions;
		this.canonicalizer = canonicalizer;
	} 
	 
	protected boolean isExcluded(String surt) {
	    String possiblePrefix = exclusions.floor(surt);
	    return (possiblePrefix != null && surt.startsWith(possiblePrefix));
	} 
 
	/* (non-Javadoc) 
	 * @see org.archive.wayback.resourceindex.SearchResultFilter#filterSearchResult(org.archive.wayback.core.SearchResult) 
	 */ 
	public int filterObject(CaptureSearchResult r) {
		if(!notifiedSeen) { 
			if(filterGroup != null) { 
				filterGroup.setSawAdministrative(); 
			} 
			notifiedSeen = true;
		} 
		String surt;
4
CodeRank
This code example shows how to use the following methods:floor
		address.add(addr);
		symbols.put(addr, sym);
	} 
 
	public String getSymbol(BigInteger addr) {
		BigInteger near = address.floor(addr);
		return symbols.get(near);
	} 
 
	public void reset() { 
		address.clear();
		symbols.clear();
	} 
 
	public HashMap<BigInteger, String> getSymbols() {
		return symbols;
	} 
} 
4
CodeRank
This code example shows how to use the following methods:floor
	 
	public boolean isFiltered(String text) {
		if(transformer != null) {
			text = transformer.transform(text);
		} 
        String possiblePrefix = filters.floor(text);
        return (possiblePrefix != null && text.startsWith(possiblePrefix));
	} 
} 
4
CodeRank
This code example shows how to use the following methods:floor
public class Validity { 
     
    private TreeSet<Date> validity = new TreeSet<>();
     
    public Date getLastDate(Date current) {
        return validity.floor(current);
    } 
     
    public void add(String date) throws ParseException {
         
        Date newDate;
        newDate = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH).parse(date);
        add(newDate);
    } 
     
    public void add(Date date) {
        if (!validity.contains(date)) {
            validity.add(date);
        } 
    } 
4
CodeRank
floor Method Overview
Returns the greatest element in this set less than or equal to the given element, or null if there is no such element.
See Code Examples for other Java 8 TreeSet Methods: