Squeak Class Documentation category index | class index  
 
OrderedCollection
  category: Collections-Sequenceable
  superclass: SequenceableCollection
  subclasses: SortedCollection GraphicSymbol UrlArgumentList

I represent a collection of objects ordered by the collector.

instance methods
  accessing
  at:
at:put:
capacity
inspect
size

  adding
  add:
add:after:
add:afterIndex:
add:before:
addAll:
addAllFirst:
addAllFirstUnlessAlreadyPresent:
addAllLast:
addFirst:
addLast:
grow
growSize

  copying
  copyEmpty
copyFrom:to:
copyReplaceFrom:to:with:
copyWith:
reversed

  enumerating
  collect:
collect:from:to:
do:
reverseDo:
select:
with:collect:
withIndexCollect:

  private
  collector
errorConditionNotSatisfied
errorNoSuchElement
find:
insert:before:
makeRoomAtFirst
makeRoomAtLast
removeIndex:
reset
resetTo:
setCollection:
setContents:

  removing
  remove:ifAbsent:
removeAllSuchThat:
removeAt:
removeFirst
removeLast

  testing
  hasContentsInExplorer

class methods
  examples
  exampleFor:

  instance creation
  new
new:
newFrom:
ofSize:

instance methods
  accessing top  
 

at:

Answer my element at index anInteger. at: is used by a knowledgeable
client to access an existing element


 

at:put:

Put anObject at element index anInteger. at:put: cannot be used to
append, front or back, to an ordered collection; it is used by a
knowledgeable client to replace an element.


 

capacity

Answer the current capacity of the receiver.


 

inspect

Open an OrderedCollectionInspector on the receiver.
Use basicInspect to get a normal type of inspector.


 

size

Answer how many elements the receiver contains.


  adding top  
 

add:

Include newObject as one of the receiver's elements. Answer newObject.
ArrayedCollections cannot respond to this message.


 

add:after:

Add the argument, newObject, as an element of the receiver. Put it in
the sequence just succeeding oldObject. Answer newObject.


 

add:afterIndex:

Add the argument, newObject, as an element of the receiver. Put it in
the sequence just after index. Answer newObject.


 

add:before:

Add the argument, newObject, as an element of the receiver. Put it in
the sequence just preceding oldObject. Answer newObject.


 

addAll:

Add each element of aCollection at my end. Answer aCollection.


 

addAllFirst:

Add each element of anOrderedCollection at the beginning of the
receiver. Answer anOrderedCollection.


 

addAllFirstUnlessAlreadyPresent:

Add each element of anOrderedCollection at the beginning of the receiver, preserving the order, but do not add any items that are already in the receiver. Answer anOrderedCollection.


 

addAllLast:

Add each element of anOrderedCollection at the end of the receiver.
Answer anOrderedCollection.


 

addFirst:

Add newObject to the beginning of the receiver. Answer newObject.


 

addLast:

Add newObject to the end of the receiver. Answer newObject.


 

grow

Become larger. Typically, a subclass has to override this if the subclass
adds instance variables.


 

growSize


  copying top  
 

copyEmpty

Answer a copy of the receiver that contains no elements.


 

copyFrom:to:

Answer a copy of the receiver that contains elements from position
startIndex to endIndex.


 

copyReplaceFrom:to:with:

Answer a copy of the receiver with replacementCollection's elements in
place of the receiver's start'th to stop'th elements. This does not expect
a 1-1 map from replacementCollection to the start to stop elements, so it
will do an insert or append.


 

copyWith:

Answer a copy of the receiver that is 1 bigger than the receiver and
includes the argument, newElement, at the end.


 

reversed

Answer a copy of the receiver with element order reversed.


  enumerating top  
 

collect:

Evaluate aBlock with each of my elements as the argument. Collect the
resulting values into a collection that is like me. Answer the new
collection. Override superclass in order to use addLast:, not at:put:.


 

collect:from:to:

Override superclass in order to use addLast:, not at:put:.


 

do:

Override the superclass for performance reasons.


 

reverseDo:

Override the superclass for performance reasons.


 

select:

Evaluate aBlock with each of my elements as the argument. Collect into
a new collection like the receiver, only those elements for which aBlock
evaluates to true.


 

with:collect:

Collect and return the result of evaluating twoArgBlock with
corresponding elements from this collection and otherCollection.


 

withIndexCollect:

Just like with:collect: except that the iteration index supplies the second argument to the block. Override superclass in order to use addLast:, not at:put:.


  private top  
 

collector

Private


 

errorConditionNotSatisfied


 

errorNoSuchElement


 

find:


 

insert:before:


 

makeRoomAtFirst


 

makeRoomAtLast


 

removeIndex:


 

reset


 

resetTo:


 

setCollection:


 

setContents:


  removing top  
 

remove:ifAbsent:

SequencableCollections cannot implement removing.


 

removeAllSuchThat:

Remove each element of the receiver for which aBlock evaluates to true.
The method in Collection is O(N^2), this is O(N).


 

removeAt:


 

removeFirst

Remove the first element of the receiver and answer it. If the receiver is
empty, create an error notification.


 

removeLast

Remove the last element of the receiver and answer it. If the receiver is
empty, create an error notification.


  testing top  
 

hasContentsInExplorer


class methods
  examples top  
 

exampleFor:

Provide a MethodCall with a valid example of aSelector, ready to run. If 'all', provide all tests we know about for SUnit tests. When 'all', each will be a Verifier, with an expected answer. Returns a list of MethodCalls, Verifiers, or VerifierOfPropertys.


  instance creation top  
 

new

Answer a new instance of the receiver (which is a class) with no indexable variables. Fail if the class is indexable.


 

new:

Answer an instance of this class with the number of indexable
variables specified by the argument, sizeRequested.


 

newFrom:

Answer an instance of me containing the same elements as aCollection.


 

ofSize:

Create a new collection of size n with nil as its elements.
This method exists because OrderedCollection new: n creates an
empty collection, not one of size n.