const classafConcurrent::SynchronizedList
sys::Obj afConcurrent::SynchronizedList
A List that provides fast reads and synchronised writes between threads, ensuring data integrity.
The list is stored in an AtomicRef through which all reads are made.
All write operations ( get, remove & clear ) are made via synchronized blocks ensuring no data is lost during race conditions. Writing makes a rw copy of the map and is thus a more expensive operation.
All values held in the list must be immutable.
- add
Add the specified item to the end of the list. Return this.
- clear
This clear()Remove all key/value pairs from the map. Return this.
- contains
Returns
trueif this list contains the specified item.- each
Call the specified function for every item in the list.
- get
Returns the item at the specified index. A negative index may be used to access an index from the end of the list.
- isEmpty
Bool isEmpty()Return
trueif size() == 0- list
Obj?[] listGets or sets a read-only copy of the backing map.
- listType
const Type listType := sys::Obj?#Used to parameterize the backing list.
- lock
const Synchronized lockThe
lockobject should you need tosynchronizeon the List.- make
new make(ActorPool actorPool, |This? f := null)Creates a
SynchronizedMapwith the givenActorPool.- remove
Removes the specified item from the list, returning the removed item. If the item was not mapped then return
null.- rw
Obj?[] rw()Get a read-write, mutable List instance with the same contents.
- size
Int size()Get the number of values in the map.