Help - Glossary - B - Bag

A Bag is an unordered collection of objects that may be duplicated. It keeps a tally for duplicated objects. It differs from a Set, which is an unordered collection of objects that may not be duplicated.

Here are a Bag and a Set using a nice notation for collecting things. Use Cmd-p on each line.

{1. 2. 3. 3. 4. 4.} asBag.
{1. 2. 3. 3. 4. 4.} asSet.

And here are lines for getting the methods for each. You'll see you can do a lot with each. Use Cmd-d on each line or on both:

ProtocolBrowser openFullProtocolForClass: Bag.
ProtocolBrowser openFullProtocolForClass: Set.

Glossary - B