Package oracle.pgx.api
Class PgxMap<K,V>
- java.lang.Object
-
- oracle.pgx.api.internal.ApiObject
-
- oracle.pgx.api.Destroyable
-
- oracle.pgx.api.PgxManagedObject
-
- oracle.pgx.api.PgxMap<K,V>
-
- Type Parameters:
K- the key typeV- 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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(K key)Blocking version ofcontainsKeyAsync(Object).PgxFuture<java.lang.Boolean>containsKeyAsync(K key)Checks if the map contains key.PgxFuture<java.lang.Void>destroyAsync()Destroys this mapMapIterable<K,V>entries()Blocking version ofentriesAsync().PgxFuture<MapIterable<K,V>>entriesAsync()Gets an entry set.Vget(K key)Blocking version ofgetAsync(Object).PgxFuture<V>getAsync(K key)Gets the value of a key.PgxGraphgetGraph()Gets the PgxGraph this map is bound to.PropertyTypegetKeyType()Gets the key type.java.lang.StringgetName()java.lang.StringgetSessionId()Gets the session id this map is bound to.PropertyTypegetValueType()Gets the value type.java.lang.Iterable<K>keys()Blocking version ofkeysAsync().PgxFuture<java.lang.Iterable<K>>keysAsync()voidput(K key, V value)Blocking version ofputAsync(Object, Object).PgxFuture<java.lang.Void>putAsync(K key, V value)Sets the value for a key in the map specified by the given name.booleanremove(K key)Blocking version ofremoveAsync(Object).PgxFuture<java.lang.Boolean>removeAsync(K key)Removes the entry specified by the given key from the map with the given name.intsize()Blocking version ofsizeAsync().PgxFuture<java.lang.Integer>sizeAsync()Returns the size of the mapjava.lang.StringtoString()-
Methods inherited from class oracle.pgx.api.PgxManagedObject
equals, hashCode
-
Methods inherited from class oracle.pgx.api.Destroyable
close, destroy
-
-
-
-
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:
getNamein classPgxManagedObject- 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:
destroyAsyncin classDestroyable- 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 entryvalue- 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
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
put
public void put(K key, V value)
Blocking version ofputAsync(Object, Object). CallsputAsync(Object, Object)and waits for the returnedPgxFutureto complete.
-
remove
public boolean remove(K key)
Blocking version ofremoveAsync(Object). CallsremoveAsync(Object)and waits for the returnedPgxFutureto complete.
-
size
public int size()
Blocking version ofsizeAsync(). CallssizeAsync()and waits for the returnedPgxFutureto complete.
-
get
public V get(K key)
Blocking version ofgetAsync(Object). CallsgetAsync(Object)and waits for the returnedPgxFutureto complete.
-
containsKey
public boolean containsKey(K key)
Blocking version ofcontainsKeyAsync(Object). CallscontainsKeyAsync(Object)and waits for the returnedPgxFutureto complete.
-
entries
public MapIterable<K,V> entries()
Blocking version ofentriesAsync(). CallsentriesAsync()and waits for the returnedPgxFutureto complete.
-
keys
public java.lang.Iterable<K> keys()
Blocking version ofkeysAsync(). CallskeysAsync()and waits for the returnedPgxFutureto complete.
-
-