BTreeMap extends AbstractMap<K,V> implements ConcurrentNavigableMap<K,V>, Bind.MapWithModificationListener<K,V> { protected Entry<K,V> findSmaller(K key,boolean inclusive){ if(key==null) throw new NullPointerException(); final long rootRecid = engine.get(rootRecidRef, Serializer.LONG_SERIALIZER); BNode n = engine.get(rootRecid, nodeSerializer); Entry<K,V> k = findSmallerRecur(n, key, inclusive); if(k==null || (k.getValue()==null)) return null; return k; } BTreeMap(Engine engine, int maxNodeSize, boolean hasValues, boolean valsOutsideNodes,
                    Serializer defaultSerializer,
                    BTreeKeySerializer<K> keySerializer, Serializer<V> valueSerializer, Comparator<K> comparator);  BTreeMap(Engine engine, long recid, Serializer defaultSerializer); @Override V get(Object key); @Override V put(K key, V value); @Override V remove(Object key); @Override void clear(); @Override boolean isEmpty(); @Override int size(); @Override V putIfAbsent(K key, V value); @Override boolean remove(Object key, Object value); @Override boolean replace(K key, V oldValue, V newValue); @Override V replace(K key, V value); @Override Comparator<? super K> comparator(); @Override Map.Entry<K,V> firstEntry(); @Override Entry<K, V> pollFirstEntry(); @Override Entry<K, V> pollLastEntry(); @Override Map.Entry<K,V> lastEntry(); @Override Map.Entry<K,V> lowerEntry(K key); @Override K lowerKey(K key); @Override Map.Entry<K,V> floorEntry(K key); @Override K floorKey(K key); @Override Map.Entry<K,V> ceilingEntry(K key); @Override K ceilingKey(K key); @Override Map.Entry<K,V> higherEntry(K key); @Override K higherKey(K key); @Override boolean containsKey(Object key); @Override boolean containsValue(Object value); @Override K firstKey(); @Override K lastKey(); @Override ConcurrentNavigableMap<K,V> subMap(K fromKey,
                                              boolean fromInclusive,
                                              K toKey,
                                              boolean toInclusive); @Override ConcurrentNavigableMap<K,V> headMap(K toKey,
                                               boolean inclusive); @Override ConcurrentNavigableMap<K,V> tailMap(K fromKey,
                                               boolean inclusive); @Override ConcurrentNavigableMap<K,V> subMap(K fromKey, K toKey); @Override ConcurrentNavigableMap<K,V> headMap(K toKey); @Override ConcurrentNavigableMap<K,V> tailMap(K fromKey); @Override NavigableSet<K> keySet(); @Override NavigableSet<K> navigableKeySet(); @Override Collection<V> values(); @Override Set<Map.Entry<K,V>> entrySet(); @Override ConcurrentNavigableMap<K,V> descendingMap(); @Override NavigableSet<K> descendingKeySet(); NavigableMap<K,V> snapshot(); @Override void addModificationListener(Bind.MapListener<K,V> listener); @Override void removeModificationListener(Bind.MapListener<K,V> listener); void close(); void printTreeStructure();  }
@Test public void findSmaller(){ BTreeMap map = new BTreeMap(engine,6,true,false, null,null,null,null); for(int i=0;i<10000; i+=3){ map.put(i, "aa"+i); } for(int i=0;i<10000; i+=1){ Integer s = i - i%3; Map.Entry e = map.findSmaller(i,true); assertEquals(s,e!=null?e.getKey():null); } assertEquals(9999, map.findSmaller(100000,true).getKey()); assertNull(map.findSmaller(0,false)); for(int i=1;i<10000; i+=1){ Integer s = i - i%3; if(s==i) s-=3; Map.Entry e = map.findSmaller(i,false); assertEquals(s,e!=null?e.getKey():null); } assertEquals(9999, map.findSmaller(100000,false).getKey()); }