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); } }
synchronized V get(long hash, K key, V value) { smallMap.startSearch(hash); while (true) { int pos = smallMap.nextPos(); if (pos < 0) { K key2 = key instanceof CharSequence ? (K) key.toString() : key; final DirectStore store = map.get(key2); if (store == null) return null; bytes.storePositionAndSize(store, 0, store.size()); break; } else { bytes.storePositionAndSize(store, pos * smallEntrySize, smallEntrySize); K key2 = getKey(); if (equals(key, key2)) break; } } if (bytesMarshallable) { try { V v = value == null ? (V) NativeBytes.UNSAFE.allocateInstance(vClass) : value; ((BytesMarshallable) v).readMarshallable(bytes); return v; } catch (InstantiationException e) { throw new AssertionError(e); } } return (V) bytes.readObject(); }
K getKey() { if (csKey) { sbKey.setLength(0); bytes.readUTFΔ(sbKey); return (K) sbKey; } return (K) bytes.readObject(); }