Home Segments Index Top Previous Next

404: Mainline

To use an ordered collection, once it is created, you need to know how to store into the ordered collection and retrieve from the ordered collection.

Consider CaloriesCollection. To store data into the CaloriesCollection, you use the addFirst: message. The following expression, for example, stores an integer into the front.

  *-- Ordered collection's name 
  | 
  |                           *-- Value to be stored 
  v                           v 
CaloriesCollection addFirst: 640