Category: Collections-Weak
Superclass: Array
I am similar to a plain array, but my items are stored in a weak object, so I track which of them are garbage collected.

Method category index

instance creation (class)
accessing (instance)
conversion (instance)
loading (instance)

instance creation (class)

new
Create a new WeakArray of size 0.

new: size

Create a new WeakArray of the given size.

top


accessing (instance)

aliveObjectsDo: aBlock
Evaluate aBlock for all the elements in the array, excluding the garbage collected ones. Note: a finalized object stays alive until the next collection (the collector has no means to see whether it was resuscitated by the finalizer), so an object being alive does not mean that it is usable.

at: index

Answer the index-th item of the receiver, or nil if it has been garbage collected.

at: index put: object

Store the value associated to the given index; plus, store in nilValues whether the object is nil. nil objects whose associated item of nilValues is 1 were touched by the garbage collector.

atAll: indices put: object

Put object at every index contained in the indices collection

atAllPut: object

Put object at every index in the receiver

clearGCFlag: index

Clear the `object has been garbage collected' flag for the item at the given index

do: aBlock

Evaluate aBlock for all the elements in the array, including the garbage collected ones (pass nil for those).

isAlive: index

Answer whether the item at the given index is still alive or has been garbage collected. Note: a finalized object stays alive until the next collection (the collector has no means to see whether it was resuscitated by the finalizer), so an object being alive does not mean that it is usable.

size

Answer the number of items in the receiver

top


conversion (instance)

asArray
Answer a non-weak version of the receiver

deepCopy

Returns a deep copy of the receiver (the instance variables are copies of the receiver's instance variables)

shallowCopy

Returns a shallow copy of the receiver (the instance variables are not copied)

species

Answer Array; this method is used in the #copyEmpty: message, which in turn is used by all collection-returning methods (collect:, select:, reject:, etc.).

top


loading (instance)

postLoad
Called after loading an object; must restore it to the state before `preStore' was called. Make it weak again

top