public class CollaborativeMap extends CollaborativeObject
Changes to the map will automatically be synced with the server and other collaborators. To
listen for changes, add EventListeners for the
EventType.VALUE_CHANGED event type.
This class should not be instantiated directly. To create a new map, use
com.goodow.realtime.Model#createMap(Object...).
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
__jsniRunAfter__() |
void |
addValueChangedListener(EventHandler<ValueChangedEvent> handler) |
void |
clear()
Removes all entries.
|
protected void |
consume(String userId,
String sessionId,
com.goodow.realtime.operation.Operation<?> operation) |
<T> T |
get(String key)
Returns the value mapped to the given key.
|
boolean |
has(String key)
Checks if this map contains an entry for the given key.
|
boolean |
isEmpty()
Returns whether this map is empty.
|
Object[][] |
items()
Returns an array containing a copy of the items in this map.
|
String[] |
keys()
Returns an array containing a copy of the keys in this map.
|
<T> T |
remove(String key)
Removes the entry for the given key (if such an entry exists).
|
void |
removeValueChangedListener(EventHandler<ValueChangedEvent> handler) |
<T> T |
set(String key,
Object value)
Put the value into the map with the given key, overwriting an existing value for that key.
|
int |
size() |
<T> List<T> |
values()
Returns an array containing a copy of the values in this map.
|
addEventListener, addObjectChangedListener, getId, removeEventListener, removeObjectChangedListener, toString@GwtIncompatible(value="J2ObjC blocked by JSNI") public static void __jsniRunAfter__()
public void addValueChangedListener(EventHandler<ValueChangedEvent> handler)
public void clear()
public <T> T get(String key)
key - The key to look up.IllegalArgumentExceptionpublic boolean has(String key)
key - The key to check.IllegalArgumentExceptionpublic boolean isEmpty()
public Object[][] items()
public String[] keys()
public <T> T remove(String key)
key - The key to unmap.IllegalArgumentExceptionpublic void removeValueChangedListener(EventHandler<ValueChangedEvent> handler)
public <T> T set(String key, Object value)
key - The map key.value - The map value.IllegalArgumentExceptionpublic int size()
public <T> List<T> values()
Copyright © 2013. All Rights Reserved.