FastSafeIterableMap extends SafeIterableMap<K, V> { public Map.Entry<K, V> ceil(K k) { if (contains(k)) { return mHashMap.get(k).mPrevious; } return null; }  @Override V putIfAbsent(@NonNull K key, @NonNull V v); @Override V remove(@NonNull K key); boolean contains(K key); Map.Entry<K, V> ceil(K k);  }
@Test public void testCeil() { FastSafeIterableMap<Integer, Boolean> map = new FastSafeIterableMap<>(); assertThat(map.ceil(1), nullValue()); map.putIfAbsent(1, false); assertThat(map.ceil(1), nullValue()); map.putIfAbsent(2, false); assertThat(map.ceil(2).getKey(), is(1)); map.remove(1); assertThat(map.ceil(2), nullValue()); }