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 boolean
containsKey(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.V
get(K key)
Blocking version ofgetAsync(Object)
.PgxFuture<V>
getAsync(K key)
Gets the value of a key.PgxGraph
getGraph()
Gets the PgxGraph this map is bound to.PropertyType
getKeyType()
Gets the key type.java.lang.String
getName()
java.lang.String
getSessionId()
Gets the session id this map is bound to.PropertyType
getValueType()
Gets the value type.java.lang.Iterable<K>
keys()
Blocking version ofkeysAsync()
.PgxFuture<java.lang.Iterable<K>>
keysAsync()
void
put(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.boolean
remove(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.int
size()
Blocking version ofsizeAsync()
.PgxFuture<java.lang.Integer>
sizeAsync()
Returns the size of the mapjava.lang.String
toString()
-
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:
getName
in 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:
destroyAsync
in 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:
toString
in classjava.lang.Object
-
put
public void put(K key, V value)
Blocking version ofputAsync(Object, Object)
. CallsputAsync(Object, Object)
and waits for the returnedPgxFuture
to complete.
-
remove
public boolean remove(K key)
Blocking version ofremoveAsync(Object)
. CallsremoveAsync(Object)
and waits for the returnedPgxFuture
to complete.
-
size
public int size()
Blocking version ofsizeAsync()
. CallssizeAsync()
and waits for the returnedPgxFuture
to complete.
-
get
public V get(K key)
Blocking version ofgetAsync(Object)
. CallsgetAsync(Object)
and waits for the returnedPgxFuture
to complete.
-
containsKey
public boolean containsKey(K key)
Blocking version ofcontainsKeyAsync(Object)
. CallscontainsKeyAsync(Object)
and waits for the returnedPgxFuture
to complete.
-
entries
public MapIterable<K,V> entries()
Blocking version ofentriesAsync()
. CallsentriesAsync()
and waits for the returnedPgxFuture
to complete.
-
keys
public java.lang.Iterable<K> keys()
Blocking version ofkeysAsync()
. CallskeysAsync()
and waits for the returnedPgxFuture
to complete.
-
-