|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface MultiMap<K,V>
A specialized map whose keys can be associated with multiple values.
Gotchas:
IMap
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.hazelcast.core.Instance |
---|
Instance.InstanceType |
Method Summary | |
---|---|
void |
addEntryListener(EntryListener<K,V> listener,
boolean includeValue)
Adds an entry listener for this multimap. |
void |
addEntryListener(EntryListener<K,V> listener,
K key,
boolean includeValue)
Adds the specified entry listener for the specified key. |
void |
addLocalEntryListener(EntryListener<K,V> listener)
Adds a local entry listener for this multimap. |
void |
clear()
Clears the multimap. |
boolean |
containsEntry(K key,
V value)
Returns whether the multimap contains the given key-value pair. |
boolean |
containsKey(K key)
Returns whether the multimap contains an entry with the key. |
boolean |
containsValue(Object value)
Returns whether the multimap contains an entry with the value. |
Set<Map.Entry<K,V>> |
entrySet()
Returns the set of key-value pairs in the multimap. |
Collection<V> |
get(K key)
Returns the collection of values associated with the key. |
String |
getName()
Returns the name of this multimap. |
Set<K> |
keySet()
Returns the set of keys in the multimap. |
Set<K> |
localKeySet()
Returns the locally owned set of keys. |
void |
lock(K key)
Acquires the lock for the specified key. |
boolean |
lockMap(long time,
TimeUnit timeunit)
Tries to acquire the lock for the entire map. |
boolean |
put(K key,
V value)
Stores a key-value pair in the multimap. |
Collection<V> |
remove(Object key)
Removes all the entries with the given key. |
boolean |
remove(Object key,
Object value)
Removes the given key value pair from the multimap. |
void |
removeEntryListener(EntryListener<K,V> listener)
Removes the specified entry listener Returns silently if there is no such listener added before. |
void |
removeEntryListener(EntryListener<K,V> listener,
K key)
Removes the specified entry listener for the specified key. |
int |
size()
Returns the number of key-value pairs in the multimap. |
boolean |
tryLock(K key)
Tries to acquire the lock for the specified key. |
boolean |
tryLock(K key,
long time,
TimeUnit timeunit)
Tries to acquire the lock for the specified key. |
void |
unlock(K key)
Releases the lock for the specified key. |
void |
unlockMap()
Unlocks the map. |
int |
valueCount(K key)
Returns number of values matching to given key in the multimap. |
Collection<V> |
values()
Returns the collection of values in the multimap. |
Methods inherited from interface com.hazelcast.core.Instance |
---|
destroy, getId, getInstanceType |
Method Detail |
---|
String getName()
boolean put(K key, V value)
Warning:
This method uses hashCode and equals of binary form of the key, not the actual implementations of hashCode and equals defined in key's class.
key
- the key to be storedvalue
- the value to be stored
Collection<V> get(K key)
Warning:
This method uses hashCode and equals of binary form of the key, not the actual implementations of hashCode and equals defined in key's class.
Warning-2:
The collection is NOT backed by the map, so changes to the map are NOT reflected in the collection, and vice-versa.
key
- the key whose associated values are to be returned
boolean remove(Object key, Object value)
Warning:
This method uses hashCode and equals of binary form of the key, not the actual implementations of hashCode and equals defined in key's class.
key
- the key of the entry to removevalue
- the value of the entry to remove
Collection<V> remove(Object key)
Warning:
This method uses hashCode and equals of binary form of the key, not the actual implementations of hashCode and equals defined in key's class.
Warning-2:
The collection is NOT backed by the map, so changes to the map are NOT reflected in the collection, and vice-versa.
key
- the key of the entries to remove
Set<K> localKeySet()
Warning:
The set is NOT backed by the map, so changes to the map are NOT reflected in the set, and vice-versa.
Set<K> keySet()
Warning:
The set is NOT backed by the map, so changes to the map are NOT reflected in the set, and vice-versa.
Collection<V> values()
Warning:
The collection is NOT backed by the map, so changes to the map are NOT reflected in the collection, and vice-versa.
Set<Map.Entry<K,V>> entrySet()
Warning:
The set is NOT backed by the map, so changes to the map are NOT reflected in the set, and vice-versa.
boolean containsKey(K key)
Warning:
This method uses hashCode and equals of binary form of the key, not the actual implementations of hashCode and equals defined in key's class.
key
- the key whose existence is checked.
boolean containsValue(Object value)
value
- the value whose existence is checked.
boolean containsEntry(K key, V value)
key
- the key whose existence is checked.value
- the value whose existence is checked.
int size()
void clear()
int valueCount(K key)
Warning:
This method uses hashCode and equals of binary form of the key, not the actual implementations of hashCode and equals defined in key's class.
key
- the key whose values count are to be returned
void addLocalEntryListener(EntryListener<K,V> listener)
multimap.put(key2, value2)
.
If the key2 is owned by member2 then the local listener will be
notified for the add/update event. Also note that entries can migrate to
other nodes for load balancing and/or membership change.
listener
- entry listenerlocalKeySet()
void addEntryListener(EntryListener<K,V> listener, boolean includeValue)
listener
- entry listenerincludeValue
- true if EntryEvent should
contain the value.void removeEntryListener(EntryListener<K,V> listener)
listener
- entry listenervoid addEntryListener(EntryListener<K,V> listener, K key, boolean includeValue)
Warning:
This method uses hashCode and equals of binary form of the key, not the actual implementations of hashCode and equals defined in key's class.
listener
- entry listenerkey
- the key to listenincludeValue
- true if EntryEvent should
contain the value.void removeEntryListener(EntryListener<K,V> listener, K key)
Warning:
This method uses hashCode and equals of binary form of the key, not the actual implementations of hashCode and equals defined in key's class.
listener
- key
- void lock(K key)
If the lock is not available then the current thread becomes disabled for thread scheduling purposes and lies dormant until the lock has been acquired.
Scope of the lock is this multimap only. Acquired lock is only for the key in this multimap. Locks are re-entrant so if the key is locked N times then it should be unlocked N times before another thread can acquire it.Warning:
This method uses hashCode and equals of binary form of the key, not the actual implementations of hashCode and equals defined in key's class.
key
- key to lock.boolean tryLock(K key)
If the lock is not available then the current thread doesn't wait and returns false immediately.
Warning:
This method uses hashCode and equals of binary form of the key, not the actual implementations of hashCode and equals defined in key's class.
key
- key to lock.
boolean tryLock(K key, long time, TimeUnit timeunit)
If the lock is not available then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of two things happens:
Warning:
This method uses hashCode and equals of binary form of the key, not the actual implementations of hashCode and equals defined in key's class.
time
- the maximum time to wait for the locktimeunit
- the time unit of the time argument.
void unlock(K key)
Warning:
This method uses hashCode and equals of binary form of the key, not the actual implementations of hashCode and equals defined in key's class.
key
- key to lock.boolean lockMap(long time, TimeUnit timeunit)
If the lock is not available then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of two things happens:
time
- the maximum time to wait for the locktimeunit
- the time unit of the time argument.
void unlockMap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |