Category: Collections-Unordered
Superclass: Collection
My instances are unordered collections of objects. You can think of me as a set with a memory; that is, if the same object is added to me twice, then I will report that that element has been stored twice.

Method category index

basic (class)
adding (instance)
enumerating the elements of a collection (instance)
extracting items (instance)
printing (instance)
removing (instance)
storing (instance)
testing collections (instance)

basic (class)

new
Answer a new instance of the receiver

new: size

Answer a new instance of the receiver, with space for size distinct objects

top


adding (instance)

add: newObject
Add an occurrence of newObject to the receiver. Answer newObject. Fail if newObject is nil.

add: newObject withOccurrences: anInteger

If anInteger > 0, add anInteger occurrences of newObject to the receiver. If anInteger < 0, remove them. Answer newObject. Fail if newObject is nil.

top


enumerating the elements of a collection (instance)

asSet
Answer a set with the elements of the receiver

do: aBlock

Evaluate the block for all members in the collection.

top


extracting items (instance)

sortedByCount
Answer a collection of counts with elements, sorted by decreasing count.

top


printing (instance)

printOn: aStream
Put on aStream a representation of the receiver

top


removing (instance)

remove: oldObject ifAbsent: anExceptionBlock
Remove oldObject from the collection and return it. If can't be found, answer instead the result of evaluationg anExceptionBlock

top


storing (instance)

storeOn: aStream
Put on aStream some Smalltalk code compiling to the receiver

top


testing collections (instance)

= aBag
Answer whether the receiver and aBag contain the same objects

hash

Answer an hash value for the receiver

includes: anObject

Answer whether we include anObject

occurrencesOf: anObject

Answer the number of occurrences of anObject found in the receiver

size

Answer the total number of objects found in the receiver

top