How to create a container of 'any' object
<p>I'm thinking of implementing a 'container' with Java where I can store any type of objects, Integer, ArrayList, etc. When getting objects from the container, I will cast each result like this:</p>

<pre><code>public void foo(int i) {
    try {
        Integer result = (Integer) container.get(i);
        // do something with result
}
    catch(...){..}

    try {
        Command result = (Command) container.get(i);
        // do something with result
    }
    catch(...){..}

    try {
        ArrayList&lt;MyClass&gt; result = (ArrayList&lt;MyClass&gt;) container.get(i);
        // do something with result
    }
    catch(...){..}
}
</code></pre>
