本文整理匯總了Java中java.util.TreeMap.ceilingEntry方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeMap.ceilingEntry方法的具體用法?Java TreeMap.ceilingEntry怎麽用?Java TreeMap.ceilingEntry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.TreeMap
的用法示例。
在下文中一共展示了TreeMap.ceilingEntry方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getBuffer
import java.util.TreeMap; //導入方法依賴的package包/類
@Override
public synchronized ByteBuffer getBuffer(boolean direct, int length) {
TreeMap<Key, ByteBuffer> tree = getBufferTree(direct);
Map.Entry<Key, ByteBuffer> entry =
tree.ceilingEntry(new Key(length, 0));
if (entry == null) {
return direct ? ByteBuffer.allocateDirect(length) :
ByteBuffer.allocate(length);
}
tree.remove(entry.getKey());
return entry.getValue();
}
示例2: indexIn
import java.util.TreeMap; //導入方法依賴的package包/類
private static Integer indexIn(TreeMap<Time, Integer> lookup, Time time, int noEntryFound) {
Entry<Time, Integer> possibleEntry = lookup.ceilingEntry(time);
if (possibleEntry == null) {
return noEntryFound;
}
return possibleEntry.getValue();
}
示例3: testCeilingEntry
import java.util.TreeMap; //導入方法依賴的package包/類
/**
* ceilingEntry returns next entry.
*/
public void testCeilingEntry() {
TreeMap map = map5();
Map.Entry e1 = map.ceilingEntry(three);
assertEquals(three, e1.getKey());
Map.Entry e2 = map.ceilingEntry(zero);
assertEquals(one, e2.getKey());
Map.Entry e3 = map.ceilingEntry(five);
assertEquals(five, e3.getKey());
Map.Entry e4 = map.ceilingEntry(six);
assertNull(e4);
}