/** * Submap version of ConcurrentSkipListMap.getNearEntry */ private Map.Entry getNearEntry(Object key, int rel) { if (isDescending) { // adjust relation for direction if ((rel & m.LT) == 0) rel |= m.LT; else rel &= ~m.LT; } if (tooLow(key)) return ((rel & m.LT) != 0)? null : lowestEntry(); if (tooHigh(key)) return ((rel & m.LT) != 0)? highestEntry() : null; for (;;) { Node n = m.findNear(key, rel); if (n == null || !inBounds(n.key)) return null; Object k = n.key; Object v = n.getValidValue(); if (v != null) return new AbstractMap.SimpleImmutableEntry(k, v); } }
/** * Submap version of ConcurrentSkipListMap.getNearEntry */ private Map.Entry getNearEntry(Object key, int rel) { if (isDescending) { // adjust relation for direction if ((rel & m.LT) == 0) rel |= m.LT; else rel &= ~m.LT; } if (tooLow(key)) return ((rel & m.LT) != 0)? null : lowestEntry(); if (tooHigh(key)) return ((rel & m.LT) != 0)? highestEntry() : null; for (;;) { Node n = m.findNear(key, rel); if (n == null || !inBounds(n.key)) return null; Object k = n.key; Object v = n.getValidValue(); if (v != null) return new AbstractMap.SimpleImmutableEntry(k, v); } }
/** * Submap version of ConcurrentSkipListMap.getNearEntry */ private Map.Entry getNearEntry(Object key, int rel) { if (isDescending) { // adjust relation for direction if ((rel & m.LT) == 0) rel |= m.LT; else rel &= ~m.LT; } if (tooLow(key)) return ((rel & m.LT) != 0)? null : lowestEntry(); if (tooHigh(key)) return ((rel & m.LT) != 0)? highestEntry() : null; for (;;) { Node n = m.findNear(key, rel); if (n == null || !inBounds(n.key)) return null; Object k = n.key; Object v = n.getValidValue(); if (v != null) return new AbstractMap.SimpleImmutableEntry(k, v); } }
public Map.Entry firstEntry() { return isDescending? highestEntry() : lowestEntry(); }
public Map.Entry firstEntry() { return isDescending? highestEntry() : lowestEntry(); }
public Map.Entry lastEntry() { return isDescending? lowestEntry() : highestEntry(); }
public Map.Entry lastEntry() { return isDescending? lowestEntry() : highestEntry(); }
public Map.Entry lastEntry() { return isDescending? lowestEntry() : highestEntry(); }
public Map.Entry firstEntry() { return isDescending? highestEntry() : lowestEntry(); }