|
|
|
@ -32,32 +32,42 @@ public interface RMultimap<K, V> extends RExpirable, RMultimapAsync<K, V> {
|
|
|
|
|
/**
|
|
|
|
|
* Returns the number of key-value pairs in this multimap.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
* @return size of multimap
|
|
|
|
|
*/
|
|
|
|
|
int size();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check is map empty
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
* @return <code>true</code> if empty
|
|
|
|
|
*/
|
|
|
|
|
boolean isEmpty();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns {@code true} if this multimap contains at least one key-value pair
|
|
|
|
|
* with the key {@code key}.
|
|
|
|
|
*
|
|
|
|
|
* @param key - map key
|
|
|
|
|
* @return <code>true</code> if contains a key
|
|
|
|
|
*/
|
|
|
|
|
boolean containsKey(Object key);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns {@code true} if this multimap contains at least one key-value pair
|
|
|
|
|
* with the value {@code value}.
|
|
|
|
|
*
|
|
|
|
|
* @param value - map value
|
|
|
|
|
* @return <code>true</code> if contains a value
|
|
|
|
|
*/
|
|
|
|
|
boolean containsValue(Object value);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns {@code true} if this multimap contains at least one key-value pair
|
|
|
|
|
* with the key {@code key} and the value {@code value}.
|
|
|
|
|
*
|
|
|
|
|
* @param key - map key
|
|
|
|
|
* @param value - map value
|
|
|
|
|
* @return <code>true</code> if contains an entry
|
|
|
|
|
*/
|
|
|
|
|
boolean containsEntry(Object key, Object value);
|
|
|
|
|
|
|
|
|
@ -69,6 +79,8 @@ public interface RMultimap<K, V> extends RExpirable, RMultimapAsync<K, V> {
|
|
|
|
|
* multimap size by 1. Other implementations prohibit duplicates, and storing
|
|
|
|
|
* a key-value pair that's already in the multimap has no effect.
|
|
|
|
|
*
|
|
|
|
|
* @param key - map key
|
|
|
|
|
* @param value - map value
|
|
|
|
|
* @return {@code true} if the method increased the size of the multimap, or
|
|
|
|
|
* {@code false} if the multimap already contained the key-value pair and
|
|
|
|
|
* doesn't allow duplicates
|
|
|
|
@ -81,6 +93,8 @@ public interface RMultimap<K, V> extends RExpirable, RMultimapAsync<K, V> {
|
|
|
|
|
* pairs in the multimap fit this description, which one is removed is
|
|
|
|
|
* unspecified.
|
|
|
|
|
*
|
|
|
|
|
* @param key - map key
|
|
|
|
|
* @param value - map value
|
|
|
|
|
* @return {@code true} if the multimap changed
|
|
|
|
|
*/
|
|
|
|
|
boolean remove(Object key, Object value);
|
|
|
|
@ -95,7 +109,9 @@ public interface RMultimap<K, V> extends RExpirable, RMultimapAsync<K, V> {
|
|
|
|
|
* }}</pre>
|
|
|
|
|
*
|
|
|
|
|
* <p>In particular, this is a no-op if {@code values} is empty.
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @param key - map key
|
|
|
|
|
* @param values - map values
|
|
|
|
|
* @return {@code true} if the multimap changed
|
|
|
|
|
*/
|
|
|
|
|
boolean putAll(K key, Iterable<? extends V> values);
|
|
|
|
@ -107,6 +123,8 @@ public interface RMultimap<K, V> extends RExpirable, RMultimapAsync<K, V> {
|
|
|
|
|
* <p>If {@code values} is empty, this is equivalent to
|
|
|
|
|
* {@link #removeAll(Object) removeAll(key)}.
|
|
|
|
|
*
|
|
|
|
|
* @param key - map key
|
|
|
|
|
* @param values - map values
|
|
|
|
|
* @return the collection of replaced values, or an empty collection if no
|
|
|
|
|
* values were previously associated with the key. The collection
|
|
|
|
|
* <i>may</i> be modifiable, but updating it will have no effect on the
|
|
|
|
@ -120,8 +138,9 @@ public interface RMultimap<K, V> extends RExpirable, RMultimapAsync<K, V> {
|
|
|
|
|
* <p>Once this method returns, {@code key} will not be mapped to any values,
|
|
|
|
|
* so it will not appear in {@link #keySet()}, {@link #asMap()}, or any other
|
|
|
|
|
* views.
|
|
|
|
|
* <p>Use {@link #fastRemove()} if values are not needed.</p>
|
|
|
|
|
*
|
|
|
|
|
* <p>Use {@link RMultimap#fastRemove()} if values are not needed.</p>
|
|
|
|
|
*
|
|
|
|
|
* @param key - map key
|
|
|
|
|
* @return the values that were removed (possibly empty). The returned
|
|
|
|
|
* collection <i>may</i> be modifiable, but updating it will have no
|
|
|
|
|
* effect on the multimap.
|
|
|
|
@ -141,6 +160,9 @@ public interface RMultimap<K, V> extends RExpirable, RMultimapAsync<K, V> {
|
|
|
|
|
*
|
|
|
|
|
* <p>Changes to the returned collection will update the underlying multimap,
|
|
|
|
|
* and vice versa.
|
|
|
|
|
*
|
|
|
|
|
* @param key - map key
|
|
|
|
|
* @return collection of values
|
|
|
|
|
*/
|
|
|
|
|
Collection<V> get(K key);
|
|
|
|
|
|
|
|
|
@ -148,8 +170,8 @@ public interface RMultimap<K, V> extends RExpirable, RMultimapAsync<K, V> {
|
|
|
|
|
* Returns all elements at once. Result collection is <b>NOT</b> backed by map,
|
|
|
|
|
* so changes are not reflected in map.
|
|
|
|
|
*
|
|
|
|
|
* @param key
|
|
|
|
|
* @return
|
|
|
|
|
* @param key - map key
|
|
|
|
|
* @return collection of values
|
|
|
|
|
*/
|
|
|
|
|
Collection<V> getAll(K key);
|
|
|
|
|
|
|
|
|
@ -160,11 +182,15 @@ public interface RMultimap<K, V> extends RExpirable, RMultimapAsync<K, V> {
|
|
|
|
|
*
|
|
|
|
|
* <p>Changes to the returned set will update the underlying multimap, and
|
|
|
|
|
* vice versa. However, <i>adding</i> to the returned set is not possible.
|
|
|
|
|
*
|
|
|
|
|
* @return set of keys
|
|
|
|
|
*/
|
|
|
|
|
Set<K> keySet();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the count of distinct keys in this multimap.
|
|
|
|
|
*
|
|
|
|
|
* @return keys amount
|
|
|
|
|
*/
|
|
|
|
|
int keySize();
|
|
|
|
|
|
|
|
|
@ -176,6 +202,8 @@ public interface RMultimap<K, V> extends RExpirable, RMultimapAsync<K, V> {
|
|
|
|
|
* <p>Changes to the returned collection will update the underlying multimap,
|
|
|
|
|
* and vice versa. However, <i>adding</i> to the returned collection is not
|
|
|
|
|
* possible.
|
|
|
|
|
*
|
|
|
|
|
* @return collection of values
|
|
|
|
|
*/
|
|
|
|
|
Collection<V> values();
|
|
|
|
|
|
|
|
|
@ -186,6 +214,8 @@ public interface RMultimap<K, V> extends RExpirable, RMultimapAsync<K, V> {
|
|
|
|
|
* <p>Changes to the returned collection or the entries it contains will
|
|
|
|
|
* update the underlying multimap, and vice versa. However, <i>adding</i> to
|
|
|
|
|
* the returned collection is not possible.
|
|
|
|
|
*
|
|
|
|
|
* @return collection of entries
|
|
|
|
|
*/
|
|
|
|
|
Collection<Map.Entry<K, V>> entries();
|
|
|
|
|
|
|
|
|
@ -195,7 +225,7 @@ public interface RMultimap<K, V> extends RExpirable, RMultimapAsync<K, V> {
|
|
|
|
|
* Works faster than <code>RMultimap.remove</code> but not returning
|
|
|
|
|
* the value associated with <code>key</code>
|
|
|
|
|
*
|
|
|
|
|
* @param keys
|
|
|
|
|
* @param keys - map keys
|
|
|
|
|
* @return the number of keys that were removed from the hash, not including specified but non existing keys
|
|
|
|
|
*/
|
|
|
|
|
long fastRemove(K ... keys);
|
|
|
|
|