|
|
6.108 OrderedCollection
- Defined in namespace Smalltalk
- Category: Collections-Sequenceable
- My instances represent ordered collections of arbitrary typed objects which
are not directly accessible by an index. They can be accessed indirectly
through an index, and can be manipulated by adding to the end or based
on content (such as add:after:)
6.108.1 OrderedCollection class: instance creation
- new
- Answer an OrderedCollection of default size
- new: anInteger
- Answer an OrderedCollection of size anInteger
6.108.2 OrderedCollection: accessing
- at: anIndex
- Answer the anIndex-th item of the receiver
- at: anIndex put: anObject
- Store anObject at the anIndex-th item of the receiver, answer anObject
- size
- Return the number of objects in the receiver
6.108.3 OrderedCollection: adding
- add: anObject
- Add anObject in the receiver, answer it
- add: newObject after: oldObject
- Add newObject in the receiver just after oldObject, answer it. Fail if oldObject can't be found
- add: newObject afterIndex: i
- Add newObject in the receiver just after the i-th, answer it. Fail if i < 0 or i > self size
- add: newObject before: oldObject
- Add newObject in the receiver just before oldObject, answer it. Fail if oldObject can't be found
- add: newObject beforeIndex: i
- Add newObject in the receiver just before the i-th, answer it. Fail if i < 1 or i > self size + 1
- addAll: aCollection
- Add every item of aCollection to the receiver, answer it
- addAll: newCollection after: oldObject
- Add every item of newCollection to the receiver just after oldObject, answer it. Fail if oldObject is not found
- addAll: newCollection afterIndex: i
- Add every item of newCollection to the receiver just after the i-th, answer it. Fail if i < 0 or i > self size
- addAll: newCollection before: oldObject
- Add every item of newCollection to the receiver just before oldObject, answer it. Fail if oldObject is not found
- addAll: newCollection beforeIndex: i
- Add every item of newCollection to the receiver just before the i-th, answer it. Fail if i < 1 or i > self size + 1
- addAllFirst: aCollection
- Add every item of newCollection to the receiver right at the start of the receiver. Answer aCollection
- addAllLast: aCollection
- Add every item of newCollection to the receiver right at the end of the receiver. Answer aCollection
- addFirst: newObject
- Add newObject to the receiver right at the start of the receiver. Answer newObject
- addLast: newObject
- Add newObject to the receiver right at the end of the receiver. Answer newObject
6.108.4 OrderedCollection: removing
- remove: anObject ifAbsent: aBlock
- Remove anObject from the receiver. If it can't be found, answer the result of evaluating aBlock
- removeAtIndex: anIndex
- Remove the object at index anIndex from the receiver. Fail if the index is out of bounds
- removeFirst
- Remove an object from the start of the receiver. Fail if the receiver is empty
- removeLast
- Remove an object from the end of the receiver. Fail if the receiver is empty
|