|
|
6.4 ArrayedCollection
- Defined in namespace Smalltalk
- Category: Collections-Sequenceable
- My instances are objects that are generally fixed size, and are accessed
by an integer index. The ordering of my instance's elements is determined
externally; I will not rearrange the order of the elements.
6.4.1 ArrayedCollection class: instance creation
- new
- Answer an empty collection
- new: size withAll: anObject
- Answer a collection with the given size, whose elements are all set to anObject
- with: element1
- Answer a collection whose only element is element1
- with: element1 with: element2
- Answer a collection whose only elements are the parameters in the order they were passed
- with: element1 with: element2 with: element3
- Answer a collection whose only elements are the parameters in the order they were passed
- with: element1 with: element2 with: element3 with: element4
- Answer a collection whose only elements are the parameters in the order they were passed
- with: element1 with: element2 with: element3 with: element4 with: element5
- Answer a collection whose only elements are the parameters in the order they were passed
- withAll: aCollection
- Answer a collection whose elements are the same as those in aCollection
6.4.2 ArrayedCollection: basic
- , aSequenceableCollection
- Answer a new instance of an ArrayedCollection containing all the elements in the receiver, followed by all the elements in aSequenceableCollection
- add: value
- This method should not be called for instances of this class.
- copyFrom: start to: stop
- Answer a new collection containing all the items in the receiver from the start-th and to the stop-th
- copyWith: anElement
- Answer a new instance of an ArrayedCollection containing all the elements in the receiver, followed by the single item anElement
- copyWithout: oldElement
- Answer a copy of the receiver to which all occurrences of oldElement are removed
6.4.3 ArrayedCollection: built ins
- size
- Answer the size of the receiver
6.4.4 ArrayedCollection: copying Collections
- reverse
- Answer the receivers' contents in reverse order
6.4.5 ArrayedCollection: enumerating the elements of a collection
- collect: aBlock
- Answer a new instance of an ArrayedCollection containing all the results of evaluating aBlock passing each of the receiver's elements
- reject: aBlock
- Answer a new instance of an ArrayedCollection containing all the elements in the receiver which, when passed to aBlock, answer false
- select: aBlock
- Answer a new instance of an ArrayedCollection containing all the elements in the receiver which, when passed to aBlock, answer true
- with: aSequenceableCollection collect: aBlock
- Evaluate aBlock for each pair of elements took respectively from the re- ceiver and from aSequenceableCollection; answer a collection of the same kind of the receiver, made with the block's return values. Fail if the receiver has not the same size as aSequenceableCollection.
6.4.6 ArrayedCollection: storing
- storeOn: aStream
- Store Smalltalk code compiling to the receiver on aStream
|