mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-13 04:15:22 +00:00
perf[orm]: lpmap的接口使用抽象方法forEach
This commit is contained in:
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) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user