Category: Collections
Superclass: Iterable
I am an abstract class. My instances are collections of objects. My subclasses may place some restrictions or add some definitions to how the objects are stored or organized; I say nothing about this. I merely provide some object creation and access routines for general collections of objects.

Method category index

instance creation (class)
multibyte encodings (class)
adding (instance)
compiler (instance)
concatenating (instance)
converting (instance)
copying Collections (instance)
copying SequenceableCollections (instance)
enumeration (instance)
finalization (instance)
printing (instance)
removing (instance)
sorting (instance)
storing (instance)
testing collections (instance)

instance creation (class)

from: anArray
Convert anArray to an instance of the receiver. anArray is structured such that the instance can be conveniently and fully specified using brace-syntax, possibly by imposing some additional structure on anArray.

join: aCollection

Answer a collection formed by treating each element in aCollection as a `withAll:' argument collection to be added to a new instance.

with: anObject

Answer a collection whose only element is anObject

with: firstObject with: secondObject

Answer a collection whose only elements are the parameters in the order they were passed

with: firstObject with: secondObject with: thirdObject

Answer a collection whose only elements are the parameters in the order they were passed

with: firstObject with: secondObject with: thirdObject with: fourthObject

Answer a collection whose only elements are the parameters in the order they were passed

with: firstObject with: secondObject with: thirdObject with: fourthObject with: fifthObject

Answer a collection whose only elements are the parameters in the order they were passed

withAll: aCollection

Answer a collection whose elements are all those in aCollection

top


multibyte encodings (class)

isUnicode
Answer true; the receiver is able to store arbitrary Unicode characters.

top


adding (instance)

add: newObject
Add newObject to the receiver, answer it

addAll: aCollection

Adds all the elements of 'aCollection' to the receiver, answer aCollection

top


compiler (instance)

literalEquals: anObject
Not commented.

literalHash

Not commented.

top


concatenating (instance)

join
Answer a new collection like my first element, with all the elements (in order) of all my elements, which should be collections. I use my first element instead of myself as a prototype because my elements are more likely to share the desired properties than I am, such as in: #('hello, ' 'world') join => 'hello, world'

top


converting (instance)

asArray
Answer an Array containing all the elements in the receiver

asBag

Answer a Bag containing all the elements in the receiver

asByteArray

Answer a ByteArray containing all the elements in the receiver

asOrderedCollection

Answer an OrderedCollection containing all the elements in the receiver

asRunArray

Answer the receiver converted to a RunArray. If the receiver is not ordered the order of the elements in the RunArray might not be the #do: order.

asSet

Answer a Set containing all the elements in the receiver with no duplicates

asSortedCollection

Answer a SortedCollection containing all the elements in the receiver with the default sort block - [ :a :b | a <= b ]

asSortedCollection: aBlock

Answer a SortedCollection whose elements are the elements of the receiver, sorted according to the sort block aBlock

asString

Answer a String containing all the elements in the receiver

asUnicodeString

Answer a UnicodeString containing all the elements in the receiver

top


copying Collections (instance)

copyReplacing: targetObject withObject: newObject
Copy replacing each object which is = to targetObject with newObject

copyWith: newElement

Answer a copy of the receiver to which newElement is added

copyWithout: oldElement

Answer a copy of the receiver to which all occurrences of oldElement are removed

top


copying SequenceableCollections (instance)

, anIterable
Append anIterable at the end of a copy of the receiver (using #add:), and answer a new collection

top


enumeration (instance)

anyOne
Answer an unspecified element of the collection.

collect: aBlock

Answer a new instance of a Collection containing all the results of evaluating aBlock passing each of the receiver's elements

gather: aBlock

Answer a new instance of a Collection containing all the results of evaluating aBlock, joined together. aBlock should return collections. The result is the same kind as the first collection, returned by aBlock (as for #join).

readStream

Answer a stream that gives elements of the receiver

reject: aBlock

Answer a new instance of a Collection containing all the elements in the receiver which, when passed to aBlock, don't answer true

select: aBlock

Answer a new instance of a Collection containing all the elements in the receiver which, when passed to aBlock, answer true

top


finalization (instance)

mourn: anObject
Private - anObject has been found to have a weak key, remove it and possibly finalize the key.

top


printing (instance)

displayLines
Print each element of the receiver to a line on standard output.

examineOn: aStream

Print all the instance variables and objects in the receiver on aStream

printOn: aStream

Print a representation of the receiver on aStream

top


removing (instance)

empty
Remove everything from the receiver.

remove: oldObject

Remove oldObject from the receiver. If absent, fail, else answer oldObject.

remove: oldObject ifAbsent: anExceptionBlock

Remove oldObject from the receiver. If absent, evaluate anExceptionBlock and answer the result, else answer oldObject.

removeAll: aCollection

Remove each object in aCollection, answer aCollection, fail if some of them is absent. Warning: this could leave the collection in a semi-updated state.

removeAll: aCollection ifAbsent: aBlock

Remove each object in aCollection, answer aCollection; if some element is absent, pass it to aBlock.

removeAllSuchThat: aBlock

Remove from the receiver all objects for which aBlock returns true.

top


sorting (instance)

sorted
Return a sequenceable collection with the contents of the receiver sorted according to the default sort block, which uses #<= to compare items.

sorted: sortBlock

Return a sequenceable collection with the contents of the receiver sorted according to the given sort block, which accepts pair of items and returns true if the first item is less than the second one.

top


storing (instance)

storeOn: aStream
Store Smalltalk code compiling to the receiver on aStream

top


testing collections (instance)

capacity
Answer how many elements the receiver can hold before having to grow.

identityIncludes: anObject

Answer whether we include the anObject object

includes: anObject

Answer whether we include anObject

includesAllOf: aCollection

Answer whether we include all of the objects in aCollection

includesAnyOf: aCollection

Answer whether we include any of the objects in aCollection

isEmpty

Answer whether we are (still) empty

isSequenceable

Answer whether the receiver can be accessed by a numeric index with #at:/#at:put:.

notEmpty

Answer whether we include at least one object

occurrencesOf: anObject

Answer how many occurrences of anObject we include

size

Answer how many objects we include

top