Class PgxMap<K,​V>

  • Type Parameters:
    K - the key type
    V - the value type
    All Implemented Interfaces:
    java.lang.AutoCloseable

    public class PgxMap<K,​V>
    extends PgxManagedObject
    A map is a collection of key-value pairs.
    • Method Detail

      • getGraph

        public PgxGraph getGraph()
        Gets the PgxGraph this map is bound to.
        Returns:
        the graph this PgxMap is bound to.
      • getSessionId

        public java.lang.String getSessionId()
        Gets the session id this map is bound to.
        Returns:
        the session id this PgxMap is bound to.
      • getName

        public java.lang.String getName()
        Specified by:
        getName in class PgxManagedObject
        Returns:
        the name identifying this managed object
      • getKeyType

        public PropertyType getKeyType()
        Gets the key type.
        Returns:
        the key type
      • getValueType

        public PropertyType getValueType()
        Gets the value type.
        Returns:
        the value type
      • destroyAsync

        public PgxFuture<java.lang.Void> destroyAsync()
        Destroys this map
        Specified by:
        destroyAsync in class Destroyable
        Returns:
        a future which will be completed once the destruction request finishes.
      • putAsync

        public PgxFuture<java.lang.Void> putAsync​(K key,
                                                  V value)
        Sets the value for a key in the map specified by the given name. Returns the old value for the given key or null if there was no entry for this key before.
        Parameters:
        key - key of the entry
        value - new value
        Returns:
        old value for the key or null if there was no entry before
      • removeAsync

        public PgxFuture<java.lang.Boolean> removeAsync​(K key)
        Removes the entry specified by the given key from the map with the given name. Returns true if the map did contain an entry with the given key, false otherwise.
        Parameters:
        key - key of the entry in the map to be removed.
        Returns:
        true if the map contained the key.
      • sizeAsync

        public PgxFuture<java.lang.Integer> sizeAsync()
        Returns the size of the map
        Returns:
        size
      • getAsync

        public PgxFuture<V> getAsync​(K key)
        Gets the value of a key.
        Parameters:
        key -
        Returns:
        value
      • containsKeyAsync

        public PgxFuture<java.lang.Boolean> containsKeyAsync​(K key)
        Checks if the map contains key.
        Parameters:
        key - the key
        Returns:
        the pgx future
      • entriesAsync

        public PgxFuture<MapIterable<K,​V>> entriesAsync()
        Gets an entry set.
        Returns:
        an iterable of the entry set
      • keysAsync

        public PgxFuture<java.lang.Iterable<K>> keysAsync()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object