public int pollDecrementHigherKey(int x) {
int savedKey, savedValue;
if (this.higherKey(x) == null) {
return null; // COMPILE-TIME ERROR
}
else if (this.get(this.higherKey(x)) > 1) {
savedKey = this.higherKey(x);
savedValue = this.get(this.higherKey(x)) - 1;
this.remove(savedKey);
this.put(savedKey, savedValue);
return savedKey;
}
else {
savedKey = this.higherKey(x);
this.remove(savedKey);
return savedKey;
}
}
该方法位于作为 TreeMap 扩展的类中,如果这有什么不同的话……有什么想法为什么我不能在这里返回 null 吗?