perf[orm]: lpmap的接口使用抽象方法forEach

This commit is contained in:
jaysunxiao committed 2021-09-03 18:51:30 +08:00
1 parent b795015ba0
commit 6530c54018
2 files changed
+3 -6

No files matched your search

@@ -173,7 +173,7 @@ public class FileChannelMap<V extends IPacket> implements LpMap<V>, Closeable {
@Override
public void forEach(BiConsumer<Long, V> biConsumer) {
for (var i = 0L; i < getMaxIndex(); i++) {
for (var i = 0L; i <= getMaxIndex(); i++) {
var value = get(i);
if (value != null) {
biConsumer.accept(i, value);
@@ -52,14 +52,11 @@ public interface LpMap<V extends IPacket> {
void clear();
void forEach(BiConsumer<Long, V> biConsumer);
default void checkKey(long key) {
if (key < 0) {
throw new RunException("key[{}]只能为大于等于0的正数", key);
}
}
default void forEach(BiConsumer<Long, V> biConsumer) {
}
}