Adding collections from different instances

collections, smalltalk

Solution

Try something like this:

armories inject: OrderedCollection new into: [:collection :armory |
   collection addAll: armory weapons; yourself].

Problem

I am new to Smalltalk and I am trying to do a very simple program that would produce a single collection, out of multiple collections in this way: Let's say I have a Set of Armories, and every Armory has it's own Weapons Set, what I would like to do is to write a method that would return a single collection with all the Weapons from every Armory combined. Thanks in advance for your help!

Original source