- If you want to create a collection,
then instantiate one of the following patterns:
Array new: size
OrderedCollection new
Bag new
Set new
SortedCollection new
- If you want to iterate over the elements in a collection, then
instantiate the following pattern:
collection do: [:element | ... element ...]
- If you have an ordered collection, and you want to store an
expression's value into the ordered collection, then instantiate one of
the following patterns:
ordered collection addFirst: expression
ordered collection addLast: expression
- If you have values stored in an ordered collection, and you want to
retrieve one of those values, then instantiate one of the following patterns:
ordered collection first
ordered collection last
- If you have values stored in an ordered collection, and you want to remove one of
those values, then instantiate one of the the following patterns:
ordered collection removeFirst
ordered collection removeLast
- If you have a bag, set, or sorted collection, and you want to store an
expression's value into the collection, then instantiate the following
pattern:
ordered collection add: expression
- If you want to convert one kind of collection into another, then send
asArray
, asOrderedCollection
, asBag
, asSet
,
or asSortedCollection
.