本文整理了Java中java.util.concurrent.ConcurrentSkipListMap.findNear()
方法的一些代码示例,展示了ConcurrentSkipListMap.findNear()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ConcurrentSkipListMap.findNear()
方法的具体详情如下:
包路径:java.util.concurrent.ConcurrentSkipListMap
类名称:ConcurrentSkipListMap
方法名:findNear
[英]Utility for ceiling, floor, lower, higher methods.
[中]适用于天花板、地板、较低、较高的方法。
代码示例来源:origin: robovm/robovm
/**
* @param key the key
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException if the specified key is null
*/
public K floorKey(K key) {
Node<K,V> n = findNear(key, LT|EQ);
return (n == null) ? null : n.key;
}
代码示例来源:origin: robovm/robovm
/**
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException if the specified key is null
*/
public K lowerKey(K key) {
Node<K,V> n = findNear(key, LT);
return (n == null) ? null : n.key;
}
代码示例来源:origin: robovm/robovm
/**
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException if the specified key is null
*/
public K ceilingKey(K key) {
Node<K,V> n = findNear(key, GT|EQ);
return (n == null) ? null : n.key;
}
代码示例来源:origin: robovm/robovm
/**
* @param key the key
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException if the specified key is null
*/
public K higherKey(K key) {
Node<K,V> n = findNear(key, GT);
return (n == null) ? null : n.key;
}
代码示例来源:origin: robovm/robovm
/**
* Returns lowest node. This node might not be in range, so
* most usages need to check bounds.
*/
private ConcurrentSkipListMap.Node<K,V> loNode() {
if (lo == null)
return m.findFirst();
else if (loInclusive)
return m.findNear(lo, GT|EQ);
else
return m.findNear(lo, GT);
}
代码示例来源:origin: robovm/robovm
/**
* Returns highest node. This node might not be in range, so
* most usages need to check bounds.
*/
private ConcurrentSkipListMap.Node<K,V> hiNode() {
if (hi == null)
return m.findLast();
else if (hiInclusive)
return m.findNear(hi, LT|EQ);
else
return m.findNear(hi, LT);
}
代码示例来源:origin: robovm/robovm
/**
* Returns SimpleImmutableEntry for results of findNear.
* @param key the key
* @param rel the relation -- OR'ed combination of EQ, LT, GT
* @return Entry fitting relation, or null if no such
*/
AbstractMap.SimpleImmutableEntry<K,V> getNear(K key, int rel) {
for (;;) {
Node<K,V> n = findNear(key, rel);
if (n == null)
return null;
AbstractMap.SimpleImmutableEntry<K,V> e = n.createSnapshot();
if (e != null)
return e;
}
}
代码示例来源:origin: robovm/robovm
/**
* Submap version of ConcurrentSkipListMap.getNearEntry
*/
private Map.Entry<K,V> getNearEntry(K key, int rel) {
if (isDescending) { // adjust relation for direction
if ((rel & LT) == 0)
rel |= LT;
else
rel &= ~LT;
}
if (tooLow(key))
return ((rel & LT) != 0) ? null : lowestEntry();
if (tooHigh(key))
return ((rel & LT) != 0) ? highestEntry() : null;
for (;;) {
Node<K,V> n = m.findNear(key, rel);
if (n == null || !inBounds(n.key))
return null;
K k = n.key;
V v = n.getValidValue();
if (v != null)
return new AbstractMap.SimpleImmutableEntry<K,V>(k, v);
}
}
代码示例来源:origin: robovm/robovm
Node<K,V> n = m.findNear(key, rel);
if (n == null || !inBounds(n.key))
return null;
代码示例来源:origin: MobiVM/robovm
/**
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException if the specified key is null
*/
public K ceilingKey(K key) {
Node<K,V> n = findNear(key, GT|EQ);
return (n == null) ? null : n.key;
}
代码示例来源:origin: ibinti/bugvm
/**
* @param key the key
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException if the specified key is null
*/
public K floorKey(K key) {
Node<K,V> n = findNear(key, LT|EQ);
return (n == null) ? null : n.key;
}
代码示例来源:origin: org.apidesign.bck2brwsr/emul
/**
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException if the specified key is null
*/
public K ceilingKey(K key) {
Node<K,V> n = findNear(key, GT|EQ);
return (n == null) ? null : n.key;
}
代码示例来源:origin: com.jtransc/jtransc-rt
/**
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException if the specified key is null
*/
public K lowerKey(K key) {
Node<K,V> n = findNear(key, LT);
return (n == null) ? null : n.key;
}
代码示例来源:origin: MobiVM/robovm
/**
* @param key the key
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException if the specified key is null
*/
public K floorKey(K key) {
Node<K,V> n = findNear(key, LT|EQ);
return (n == null) ? null : n.key;
}
代码示例来源:origin: MobiVM/robovm
/**
* @param key the key
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException if the specified key is null
*/
public K higherKey(K key) {
Node<K,V> n = findNear(key, GT);
return (n == null) ? null : n.key;
}
代码示例来源:origin: MobiVM/robovm
/**
* Returns lowest node. This node might not be in range, so
* most usages need to check bounds.
*/
private ConcurrentSkipListMap.Node<K,V> loNode() {
if (lo == null)
return m.findFirst();
else if (loInclusive)
return m.findNear(lo, GT|EQ);
else
return m.findNear(lo, GT);
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Returns highest node. This node might not be in range, so
* most usages need to check bounds.
*/
private ConcurrentSkipListMap.Node<K,V> hiNode() {
if (hi == null)
return m.findLast();
else if (hiInclusive)
return m.findNear(hi, LT|EQ);
else
return m.findNear(hi, LT);
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Returns lowest node. This node might not be in range, so
* most usages need to check bounds.
*/
private ConcurrentSkipListMap.Node<K,V> loNode() {
if (lo == null)
return m.findFirst();
else if (loInclusive)
return m.findNear(lo, GT|EQ);
else
return m.findNear(lo, GT);
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Returns highest node. This node might not be in range, so
* most usages need to check bounds.
*/
private ConcurrentSkipListMap.Node<K,V> hiNode() {
if (hi == null)
return m.findLast();
else if (hiInclusive)
return m.findNear(hi, LT|EQ);
else
return m.findNear(hi, LT);
}
代码示例来源:origin: com.gluonhq/robovm-rt
/**
* Returns lowest node. This node might not be in range, so
* most usages need to check bounds.
*/
private ConcurrentSkipListMap.Node<K,V> loNode() {
if (lo == null)
return m.findFirst();
else if (loInclusive)
return m.findNear(lo, GT|EQ);
else
return m.findNear(lo, GT);
}
内容来源于网络,如有侵权,请联系作者删除!