forked from I2P_Developers/i2p.i2p
Blockfile: Add generics, part 4
This commit is contained in:
@ -540,7 +540,7 @@ public class BlockfileNamingService extends DummyNamingService {
|
||||
* @return removed object or null
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
private static Object removeEntry(SkipList<String, ?> sl, String key) {
|
||||
private static <V> V removeEntry(SkipList<String, V> sl, String key) {
|
||||
return sl.remove(key);
|
||||
}
|
||||
|
||||
@ -858,12 +858,12 @@ public class BlockfileNamingService extends DummyNamingService {
|
||||
SkipList<String, DestEntry> sl = _bf.getIndex(listname, _stringSerializer, _destSerializer);
|
||||
if (sl == null)
|
||||
return false;
|
||||
Object removed = removeEntry(sl, key);
|
||||
DestEntry removed = removeEntry(sl, key);
|
||||
boolean rv = removed != null;
|
||||
if (rv) {
|
||||
removeCache(hostname);
|
||||
try {
|
||||
removeReverseEntry(key, ((DestEntry)removed).dest);
|
||||
removeReverseEntry(key, removed.dest);
|
||||
} catch (ClassCastException cce) {
|
||||
_log.error("DB reverse remove error", cce);
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ public class SkipList<K extends Comparable<? super K>, V> implements Flushable {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object remove(K key) {
|
||||
public V remove(K key) {
|
||||
if(key == null) { throw new NullPointerException(); }
|
||||
Object[] res = stack.remove(stack.levels.length - 1, key, this);
|
||||
if(res != null) {
|
||||
@ -132,7 +132,7 @@ public class SkipList<K extends Comparable<? super K>, V> implements Flushable {
|
||||
stack.flush();
|
||||
}
|
||||
flush();
|
||||
return res[0];
|
||||
return (V) res[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user