Interface NitriteMap<Key,​Value>

  • Type Parameters:
    Key - the type of key
    Value - 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 in NitriteMap.
    Since:
    1.0
    Author:
    Anindya Chatterjee.
    • 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 or null otherwise.
        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
      • values

        Iterable<Value> values()
        Gets a RecordStream view of the values contained in this map.
        Returns:
        the collection view of all values in this map.
      • keys

        Iterable<Key> keys()
        Gets a RecordStream view 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 parent NitriteStore where 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.
      • 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:
        getAttributes in interface org.dizitart.no2.common.meta.AttributesAware
      • setAttributes

        default void setAttributes​(Attributes attributes)
        Sets the attributes for this map.
        Specified by:
        setAttributes in interface org.dizitart.no2.common.meta.AttributesAware
      • updateLastModifiedTime

        default void updateLastModifiedTime()
        Update last modified time of the map.