29.11.2014 Views

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Array<br />

OrderedCollection<br />

SortedCollection<br />

Dictionary<br />

Like <strong>an</strong> array in Pascal, has a fixed size (which c<strong>an</strong> be grown)<br />

<strong><strong>an</strong>d</strong> accessed by explicit position references.<br />

A bit like a linked list in Pascal or C. Elements are added to<br />

specific locations specified either as first, last or relative to<br />

<strong>an</strong>other object.<br />

A collection whose order is determined by a sort block. This<br />

block is a piece of code which returns true or false depending<br />

upon the test performed.<br />

Rather like a hash table. <strong>Object</strong>s are stored with a key <strong><strong>an</strong>d</strong><br />

accessed by a key. Dictionaries are therefore a set of key -> value<br />

associations<br />

Elements in collections are in general accessed by the at: <strong><strong>an</strong>d</strong> added by the at:put: or add:<br />

messages. It is possible to iterate over the elements of a collection using the do: construct.<br />

290

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!