public class CollaborativeList extends CollaborativeObject
Changes to the list will automatically be synced with the server and other collaborators. To listen for changes, add EventListeners for the following event types:
This class should not be instantiated directly. To create a new list, use
Model.createList(Object...).
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
__jsniRunAfter__() |
void |
addValuesAddedListener(EventHandler<ValuesAddedEvent> handler) |
void |
addValuesRemovedListener(EventHandler<ValuesRemovedEvent> handler) |
void |
addValuesSetListener(EventHandler<ValuesSetEvent> handler) |
<T> T[] |
asArray()
Returns a copy of the contents of this collaborative list as an array.
|
void |
clear()
Removes all values from the list.
|
protected void |
consume(String userId,
String sessionId,
com.goodow.realtime.operation.Operation<?> operation) |
<T> T |
get(int index)
Gets the value at the given index.
|
int |
indexOf(Object value,
Comparator<Object> opt_comparator)
Returns the first index of the given value, or -1 if it cannot be found.
|
void |
insert(int index,
Object value)
Inserts an item into the list at a given index.
|
void |
insertAll(int index,
Object... values)
Inserts a list of items into the list at a given index.
|
int |
lastIndexOf(Object value,
Comparator<Object> opt_comparator)
Returns the last index of the given value, or -1 if it cannot be found.
|
int |
length() |
int |
push(Object value)
Adds an item to the end of the list.
|
void |
pushAll(Object... values)
Adds an array of values to the end of the list.
|
IndexReference |
registerReference(int index,
boolean canBeDeleted)
Creates an IndexReference at the given index.
|
void |
remove(int index)
Removes the item at the given index from the list.
|
void |
removeListListener(EventHandler<?> handler) |
void |
removeRange(int startIndex,
int endIndex)
Removes the items between startIndex (inclusive) and endIndex (exclusive).
|
boolean |
removeValue(Object value)
Removes the first instance of the given value from the list.
|
void |
replaceRange(int index,
Object... values)
Replaces items in the list with the given items, starting at the given index.
|
void |
set(int index,
Object value)
Sets the item at the given index
|
void |
setLength(int length) |
addEventListener, addObjectChangedListener, getId, removeEventListener, removeObjectChangedListener, toString@GwtIncompatible(value="J2ObjC blocked by JSNI") public static void __jsniRunAfter__()
public void addValuesAddedListener(EventHandler<ValuesAddedEvent> handler)
public void addValuesRemovedListener(EventHandler<ValuesRemovedEvent> handler)
public void addValuesSetListener(EventHandler<ValuesSetEvent> handler)
public <T> T[] asArray()
public void clear()
public <T> T get(int index)
index - The index.ArrayIndexOutOfBoundsExceptionpublic int indexOf(Object value, Comparator<Object> opt_comparator)
value - The value to find.opt_comparator - Optional comparator function used to determine the equality of two items.public void insert(int index,
Object value)
index - The index to insert at.value - The value to add.ArrayIndexOutOfBoundsExceptionpublic void insertAll(int index,
Object... values)
index - The index at which to insert.values - The values to insert.ArrayIndexOutOfBoundsExceptionpublic int lastIndexOf(Object value, Comparator<Object> opt_comparator)
value - The value to find.opt_comparator - Optional comparator function used to determine the equality of two items.public int length()
public int push(Object value)
value - The value to add.public void pushAll(Object... values)
values - The values to add.public IndexReference registerReference(int index, boolean canBeDeleted)
index - The index of the reference.canBeDeleted - Whether this index is deleted when there is a delete of a range covering
this index.ArrayIndexOutOfBoundsExceptionpublic void remove(int index)
index - The index of the item to remove.ArrayIndexOutOfBoundsExceptionpublic void removeListListener(EventHandler<?> handler)
public void removeRange(int startIndex,
int endIndex)
startIndex - The start index of the range to remove (inclusive).endIndex - The end index of the range to remove (exclusive).ArrayIndexOutOfBoundsExceptionpublic boolean removeValue(Object value)
value - The value to remove.public void replaceRange(int index,
Object... values)
index - The index to set at.values - The values to insert.ArrayIndexOutOfBoundsExceptionpublic void set(int index,
Object value)
index - The index to insert at.value - The value to set.ArrayIndexOutOfBoundsExceptionpublic void setLength(int length)
length - the new length of the arrayArrayIndexOutOfBoundsExceptionlength()Copyright © 2013. All Rights Reserved.