Here you can find the source of findLT(SortedSet
Parameter | Description |
---|---|
T | a parameter |
ss | a SortedSet |
x | the value to search for |
protected static <T> T findLT(SortedSet<T> ss, T x)
//package com.java2s; //License from project: Creative Commons License import java.util.SortedSet; public class Main { /**/*from ww w . jav a 2s. co m*/ * Finds the largest value that is smaller than x in a SortedSet * * @param <T> * @param ss * a SortedSet * @param x * the value to search for * @return the largest value in ss that is less than x, or null if no such * value exists */ protected static <T> T findLT(SortedSet<T> ss, T x) { SortedSet<T> p = ss.headSet(x); return p.isEmpty() ? null : p.last(); } }