Class NavigableDiskMap<K,​V>

  • Type Parameters:
    K - the key type parameter
    V - the value type parameter
    All Implemented Interfaces:
    Serializable, AutoCloseable, Map<K,​V>, NavigableMap<K,​V>, SortedMap<K,​V>

    public final class NavigableDiskMap<K,​V>
    extends Object
    implements NavigableMap<K,​V>, Serializable, AutoCloseable

    A NavigableMap implementation that stores its data in a file. NavigableDiskMap are monitored to ensure that their file handle is properly closed if the it is no longer in use. However, one can use the commit and close methods to explicitly commit changes and close the map.

    NavigableDiskMap are created using a builder in the following way:

     
      var map = NavigableDiskMap.builder()
                       .file(Resources.from("/data/map.db")
                       .namespace("people")
                       .compressed(true)
                       .build();
     
     

    Once an NavigableDiskMap instance is constructed it acts like regular Java NavigableMap.

    See Also:
    Serialized Form