Package org.dizitart.no2.store
Interface NitriteMap<Key,Value>
-
- Type Parameters:
Key- the type of keyValue- the type of value
- All Superinterfaces:
org.dizitart.no2.common.meta.AttributesAware,AutoCloseable
public interface NitriteMap<Key,Value> extends org.dizitart.no2.common.meta.AttributesAware, AutoCloseable
Represents a Nitrite key-value pair map. Every piece of data in a Nitrite database is stored inNitriteMap.- Since:
- 1.0
- Author:
- Anindya Chatterjee.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description KeyceilingKey(Key key)Get the least key that is greater than or equal to this key.voidclear()Removes all entries in the map.voidclose()Closes thisNitriteMap.booleancontainsKey(Key key)Determines if the map contains a mapping for the specified key.voiddrop()Deletes the map from the store.RecordStream<Pair<Key,Value>>entries()Gets aRecordStreamview of the mappings contained in this map.KeyfloorKey(Key key)Get the largest key that is smaller or equal to this key.Valueget(Key key)Gets the value mapped with the specified key ornullotherwise.default AttributesgetAttributes()Gets the attributes of this map.StringgetName()Gets name of this map.NitriteStore<?>getStore()Gets the parentNitriteStorewhere this map is stored.KeyhigherKey(Key key)Get the lest key that is greater than the given key, or null if no such key exists.booleanisClosed()Indicates if the map already is closed.booleanisDropped()Indicates if this map is dropped already.booleanisEmpty()Indicates whether the map is empty.Iterable<Key>keys()Gets aRecordStreamview of the keys contained in this map.KeylowerKey(Key key)Get the largest key that is smaller than the given key, or null if no such key exists.voidput(Key key, Value value)Associates the specified value with the specified key in this map.ValueputIfAbsent(Key key, Value value)Add a key-value pair if it does not yet exist.Valueremove(Key key)Removes the mapping for a key from this map if it is present.RecordStream<Pair<Key,Value>>reversedEntries()Gets a reversedRecordStreamview of the mappings contained in this map.default voidsetAttributes(Attributes attributes)Sets the attributes for this map.longsize()Get the number of entries, as an integer.default voidupdateLastModifiedTime()Update last modified time of the map.Iterable<Value>values()Gets aRecordStreamview of the values contained in this map.
-
-
-
Method Detail
-
containsKey
boolean containsKey(Key key)
Determines if the map contains a mapping for the specified key.- Parameters:
key- key whose presence in this map is to be tested- Returns:
- `true` if this map contains a mapping for the specified key.
-
get
Value get(Key key)
Gets the value mapped with the specified key ornullotherwise.- Parameters:
key- the key- Returns:
- the value, or null if the key not found.
-
clear
void clear()
Removes all entries in the map.
-
isClosed
boolean isClosed()
Indicates if the map already is closed.- Returns:
- the boolean
-
close
void close()
Closes thisNitriteMap.- Specified by:
closein interfaceAutoCloseable
-
values
Iterable<Value> values()
Gets aRecordStreamview of the values contained in this map.- Returns:
- the collection view of all values in this map.
-
keys
Iterable<Key> keys()
Gets aRecordStreamview of the keys contained in this map.- Returns:
- a set view of the keys contained in this map.
-
remove
Value remove(Key key)
Removes the mapping for a key from this map if it is present.- Parameters:
key- the key whose mapping is to be removed from this map.- Returns:
- the value that has been removed.
-
put
void put(Key key, Value value)
Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced by the specified value.- Parameters:
key- key with which the specified value is to be associated (may not be null).value- value to be associated with the specified key (may not be null).
-
size
long size()
Get the number of entries, as an integer. Integer.MAX_VALUE is returned if there are more than these entries.- Returns:
- the number of entries, as an integer.
-
putIfAbsent
Value putIfAbsent(Key key, Value value)
Add a key-value pair if it does not yet exist.- Parameters:
key- the key (may not be null)value- the new value- Returns:
- the old value if the key existed, or `null` otherwise.
-
higherKey
Key higherKey(Key key)
Get the lest key that is greater than the given key, or null if no such key exists.- Parameters:
key- the key- Returns:
- the result.
-
ceilingKey
Key ceilingKey(Key key)
Get the least key that is greater than or equal to this key.- Parameters:
key- the key- Returns:
- the result.
-
lowerKey
Key lowerKey(Key key)
Get the largest key that is smaller than the given key, or null if no such key exists.- Parameters:
key- the key- Returns:
- the result.
-
floorKey
Key floorKey(Key key)
Get the largest key that is smaller or equal to this key.- Parameters:
key- the key- Returns:
- the result.
-
isEmpty
boolean isEmpty()
Indicates whether the map is empty.- Returns:
- `true` if the map is empty; `false` otherwise.
-
getStore
NitriteStore<?> getStore()
Gets the parentNitriteStorewhere this map is stored.- Returns:
- the store where this map is stored.
-
getName
String getName()
Gets name of this map.- Returns:
- the name of this map.
-
entries
RecordStream<Pair<Key,Value>> entries()
Gets aRecordStreamview of the mappings contained in this map.- Returns:
- a set view of the mappings contained in this map.
-
reversedEntries
RecordStream<Pair<Key,Value>> reversedEntries()
Gets a reversedRecordStreamview of the mappings contained in this map.- Returns:
- the record stream
-
drop
void drop()
Deletes the map from the store.
-
isDropped
boolean isDropped()
Indicates if this map is dropped already.- Returns:
- the boolean result
-
getAttributes
default Attributes getAttributes()
Gets the attributes of this map.- Specified by:
getAttributesin interfaceorg.dizitart.no2.common.meta.AttributesAware
-
setAttributes
default void setAttributes(Attributes attributes)
Sets the attributes for this map.- Specified by:
setAttributesin interfaceorg.dizitart.no2.common.meta.AttributesAware
-
updateLastModifiedTime
default void updateLastModifiedTime()
Update last modified time of the map.
-
-