why deepstreamHub? compare us getting started faq
use cases
products
developers
company
blog contact

A List is a specialised Record that contains an Array of recordNames and provides a number of convinience methods for interacting with them.

Methods

isReady()

Boolean isReady()
True if the list's initial data-set has been loaded from deepstream

isDestroyed()

Boolean isDestroyed()
Return whether the list has been destroyed. If true it needs to be recreated via RecordHandler.getList(listName)

version()

int version()
Return the list version. This is solely used within a RecordMergeStrategy

name()

String name()
Return the list name

addRecordEventsListener(listener)

List addRecordEventsListener(RecordEventsListener listener)
argument type description
listener RecordEventsListener The listener to add

Adds a Listener that will be invoked whenever a discard, delete or error event occurs

removeRecordEventsListener(listener)

List removeRecordEventsListener(RecordEventsListener listener)
argument type description
listener RecordEventsListener The listener to remove

Removes a Listener that was added via List#removeRecordEventsListener

getEntries()

List getEntries()
Returns the array of list entries or an empty array if the list hasn't been populated yet.

setEntries(entries)

List setEntries(List entries)
argument type description
entries List The recordNames to update the list with

Updates the list with a new set of entries

removeEntry(entry)

List removeEntry(String entry)
argument type description
entry String The entry to remove from the list

Removes the first occurrence of an entry from the list

removeEntry(entry,index)

List removeEntry(String entry, int index)
argument type description
entry String The entry to remove from the list
index Int The index at which the entry should reside at

Removes an entry from the list if it resides at a specific index

addEntry(entry)

List addEntry(String entry)
argument type description
entry String The entry to add to the list

Add an entry to the end of the list

addEntry(entry,index)

List addEntry(String entry, int index)
argument type description
entry String The entry to add from the list
index Int The index at which the entry should reside at

Adds an entry to the list at a specific index

isEmpty()

boolean isEmpty()
Returns true if the list is empty

subscribe(listener)

List subscribe(ListChangedListener listener)
argument type description
listener ListChangedListener The listener to add

Notifies the user whenever the list has changed

subscribe(listener,triggerNow)

List subscribe(ListChangedListener listener, boolean triggerNow)
argument type description
listener ListChangedListener The listener to add
triggerNow boolean Whether to trigger the listener immediately

Notifies the user whenever the list has changed, and notifies immediately if triggerNow is true

subscribe(listener)

List unsubscribe(ListChangedListener listener)
argument type description
listener ListChangedListener The listener to remove

Removes the listener added via subscribe(listener, triggerNow)

subscribe(listener)

List subscribe(ListEntryChangedListener listener)
argument type description
listener ListEntryChangeListener The listener to add

Add a listener to notify the user whenever an entry is added, removed or moved within the list

unsubscribe(listener)

List unsubscribe(ListEntryChangedListener listener)
argument type description
listener ListEntryChangeListener The listener to remove

Remove the listener added via subscribe(listEntryChangeListener)