const classafConcurrent::AtomicList

sys::Obj
  afConcurrent::AtomicList

A List that provides fast reads and lightweight writes between threads. Use when reads far out number the writes.

The list is stored in an AtomicRef through which all reads are made. Writing makes a rw copy of the list and is thus a more expensive operation.

CAUTION: Write operations ( add, remove & clear ) are not synchronised. This makes them lightweight but also susceptible to data-loss during race conditions. This may be acceptable for caching situations where values is easily re-calculated.

Note that all values held in the list must be immutable.

add

Source

@Operator
This add(Obj? val)

Add the specified item to the end of the list. Return this.

clear

Source

This clear()

Remove all key/value pairs from the map. Return this.

contains

Source

Bool contains(Obj? item)

Returns true if this list contains the specified item.

each

Source

Void each(|Obj?,Int c)

Call the specified function for every item in the list.

get

Source

@Operator
Obj? get(Int index)

Returns the item at the specified index. A negative index may be used to access an index from the end of the list.

isEmpty

Source

Bool isEmpty()

Return true if size() == 0

list

Source

Obj?[] list

Gets or sets a read-only copy of the backing map.

remove

Source

Obj? remove(Obj item)

Removes the specified item from the list, returning the removed item. If the item was not mapped then return null.

rw

Source

Obj?[] rw()

Get a read-write, mutable List instance with the same contents.

size

Source

Int size()

Get the number of values in the map.

valType

Source

const Type valType := sys::Obj?#

Used to parameterize the backing list.

AtomicList() { it.valType = Str# }