MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / subMap

Method subMap

Ports/CLDC11/src/java/util/TreeMap.java:882–913  ·  view source on GitHub ↗
(K startKey, K endKey)

Source from the content-addressed store, hash-verified

880 }
881
882 public SortedMap<K, V> subMap(K startKey, K endKey) {
883 checkRange(startKey);
884 Comparator<? super K> cmp = backingMap.comparator;
885 if (cmp == null) {
886 java.lang.Comparable<K> object = toComparable(endKey);
887 if (hasStart && object.compareTo(startKey) < 0) {
888 throw new IllegalArgumentException();
889 }
890 if (hasEnd && object.compareTo(endKey) > 0) {
891 throw new IllegalArgumentException();
892 }
893 } else {
894 if (hasStart
895 && backingMap.comparator().compare(endKey, this.startKey) < 0) {
896 throw new IllegalArgumentException();
897 }
898 if (hasEnd && backingMap.comparator().compare(endKey,this.endKey) > 0) {
899 throw new IllegalArgumentException();
900 }
901 }
902 Comparator<? super K> c = backingMap.comparator();
903 if (c == null) {
904 if (toComparable(startKey).compareTo(endKey) <= 0) {
905 return new SubMap<K, V>(startKey, backingMap, endKey);
906 }
907 } else {
908 if (c.compare(startKey, endKey) <= 0) {
909 return new SubMap<K, V>(startKey, backingMap, endKey);
910 }
911 }
912 throw new IllegalArgumentException();
913 }
914
915 public SortedMap<K, V> tailMap(K startKey) {
916 checkRange(startKey);

Callers

nothing calls this directly

Calls 5

checkRangeMethod · 0.95
compareToMethod · 0.65
compareMethod · 0.65
comparatorMethod · 0.65
toComparableMethod · 0.45

Tested by

no test coverage detected