MCPcopy Index your code
hub / github.com/jankotek/mapdb / SubMap

Class SubMap

src/main/java/org/mapdb/BTreeMapJava.java:621–1084  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

619
620
621 static protected class SubMap<K,V> extends AbstractMap<K,V> implements ConcurrentNavigableMap2<K,V> {
622
623 protected final ConcurrentNavigableMapExtra<K,V> m;
624
625 protected final K lo;
626 protected final boolean loInclusive;
627
628 protected final K hi;
629 protected final boolean hiInclusive;
630
631 public SubMap(ConcurrentNavigableMapExtra<K,V> m, K lo, boolean loInclusive, K hi, boolean hiInclusive) {
632 this.m = m;
633 this.lo = lo;
634 this.loInclusive = loInclusive;
635 this.hi = hi;
636 this.hiInclusive = hiInclusive;
637 if(lo!=null && hi!=null && m.comparator().compare(lo, hi)>0){
638 throw new IllegalArgumentException();
639 }
640
641
642 }
643
644
645/* ---------------- Map API methods -------------- */
646
647 @Override
648 public boolean containsKey(Object key) {
649 if (key == null) throw new NullPointerException();
650 K k = (K)key;
651 return inBounds(k) && m.containsKey(k);
652 }
653
654 @Override
655 public V get(Object key) {
656 if (key == null) throw new NullPointerException();
657 K k = (K)key;
658 return ((!inBounds(k)) ? null : m.get(k));
659 }
660
661 @Override
662 public V put(K key, V value) {
663 checkKeyBounds(key);
664 return m.put(key, value);
665 }
666
667 @Override
668 public V remove(Object key) {
669 if(key==null)
670 throw new NullPointerException("key null");
671 K k = (K)key;
672 return (!inBounds(k))? null : m.remove(k);
673 }
674
675 @Override
676 public int size() {
677 return (int) Math.min(sizeLong(), Integer.MAX_VALUE);
678 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…