Next: , Previous: , Up: ArrayedCollection   [Index]


1.5.5 ArrayedCollection: copying Collections

copyReplaceAll: oldSubCollection with: newSubCollection

Answer a new collection in which all the sequences matching oldSubCollection are replaced with newSubCollection

copyReplaceFrom: start to: stop with: replacementCollection

Answer a new collection of the same class as the receiver that contains the same elements as the receiver, in the same order, except for elements from index ‘start’ to index ‘stop’.

If start < stop, these are replaced by the contents of the replacementCollection. Instead, If start = (stop + 1), like in ‘copyReplaceFrom: 4 to: 3 with: anArray’, then every element of the receiver will be present in the answered copy; the operation will be an append if stop is equal to the size of the receiver or, if it is not, an insert before index ‘start’.

copyReplaceFrom: start to: stop withObject: anObject

Answer a new collection of the same class as the receiver that contains the same elements as the receiver, in the same order, except for elements from index ‘start’ to index ‘stop’.

If start < stop, these are replaced by stop-start+1 copies of anObject. Instead, If start = (stop + 1), then every element of the receiver will be present in the answered copy; the operation will be an append if stop is equal to the size of the receiver or, if it is not, an insert before index ‘start’.

reverse

Answer the receivers’ contents in reverse order