public Entry<K, V> getNextEntry(K prevKey) { try { int pos; if (prevKey == null) { pos = smallMap.firstPos(); } else { long hash = hasher.hash(prevKey); pos = smallMap.nextDifferentHashNonEmptyPosition(hash); } while (true) { if (pos < 0) { return null; } else { bytes.storePositionAndSize(store, pos * smallEntrySize, smallEntrySize); K key = getKey(); if (prevKey == null || !equals(key, prevKey)) { if (bytesMarshallable) { V value = (V) NativeBytes.UNSAFE.allocateInstance(vClass); ((BytesMarshallable) value).readMarshallable(bytes); return new SimpleEntry<K, V>(key, value); } else { V value = (V) bytes.readObject(); return new SimpleEntry<K, V>(key, value); } } } pos = smallMap.nextPos(); } } catch (InstantiationException e) { throw new AssertionError(e); } }
public K getNextKey(K prevKey) { int pos; if (prevKey == null) { pos = smallMap.firstPos(); } else { long hash = hasher.hash(prevKey); pos = smallMap.nextDifferentHashNonEmptyPosition(hash); } while (true) { if (pos < 0) { return null; } else { bytes.storePositionAndSize(store, pos * smallEntrySize, smallEntrySize); K key = getKey(); if (prevKey == null || !equals(key, prevKey)) { return key; } } pos = smallMap.nextPos(); } }