Interface OffHeapLongIntMap
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
OffHeapLongIntMapImpl
A primitive long-to-int map backed entirely by off-heap memory.
Designed for zero-allocation, zero-GC lookups on hot paths. Both keys and values are stored in off-heap memory.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()voidclose()Releases the underlying off-heap memory.booleancontainsKey(long key) intget(long key) Gets the value for the given key.booleanisEmpty()voidput(long key, int value) intremove(long key) Removes the key and returns its value.intsize()
-
Method Details
-
get
int get(long key) Gets the value for the given key.- Parameters:
key- The key.- Returns:
- The value, or the configured "missing value" (default -1) if not found.
-
put
void put(long key, int value) -
remove
int remove(long key) Removes the key and returns its value.- Parameters:
key- The key to remove.- Returns:
- The value, or the "missing value" if not found.
-
clear
void clear() -
size
int size() -
isEmpty
boolean isEmpty() -
containsKey
boolean containsKey(long key) -
close
void close()Releases the underlying off-heap memory.- Specified by:
closein interfaceAutoCloseable
-