diff options
Diffstat (limited to 'src/main/java/com/amazon/carbonado')
-rw-r--r-- | src/main/java/com/amazon/carbonado/repo/map/Key.java | 8 | ||||
-rw-r--r-- | src/main/java/com/amazon/carbonado/repo/map/MapStorage.java | 7 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/map/Key.java b/src/main/java/com/amazon/carbonado/repo/map/Key.java index 5032f66..218ded6 100644 --- a/src/main/java/com/amazon/carbonado/repo/map/Key.java +++ b/src/main/java/com/amazon/carbonado/repo/map/Key.java @@ -67,13 +67,7 @@ class Key<S extends Storable> implements Comparable<Key<S>> { public int compareTo(Key<S> other) {
int result = mComparator.compare(mStorable, other.mStorable);
if (result == 0) {
- int t1 = tieBreaker();
- int t2 = other.tieBreaker();
- if (t1 < t2) {
- result = -1;
- } else if (t1 > t2) {
- result = 1;
- }
+ result = tieBreaker() - other.tieBreaker();
}
return result;
}
diff --git a/src/main/java/com/amazon/carbonado/repo/map/MapStorage.java b/src/main/java/com/amazon/carbonado/repo/map/MapStorage.java index c8a6e9c..1457fae 100644 --- a/src/main/java/com/amazon/carbonado/repo/map/MapStorage.java +++ b/src/main/java/com/amazon/carbonado/repo/map/MapStorage.java @@ -682,7 +682,12 @@ class MapStorage<S extends Storable> break;
}
- map = map.tailMap(startKey, true);
+ Key<S> ceilingKey = map.ceilingKey(startKey);
+ if (ceilingKey == null) {
+ return EmptyCursor.the();
+ }
+
+ map = map.tailMap(ceilingKey, true);
}
Cursor<S> cursor;
|