How to fix unchecked type cast : <p>I am having trouble with unchecked casting. I know this happens because <code>T</code> is an <code>Object</code> but not every <code>Object</code> is a <code>T</code>. My question is how would I fix this to implement <code>T</code> in <code>ArrayList&lt;T&gt;</code> without suppressing warnings?</p>

<pre><code>public class AdjMatrix &lt;T extends Object&gt; implements Blah&lt;T&gt;
{
    public T[] vertex;

    public AdjMatrix() 
    {
        this.vertex = (T[])(new Object[RANDOM_NUMBER]);             
    }

    public ArrayList&lt;T&gt; neighbours(T vertLabel) 
    {
        ArrayList&lt;T&gt; neighbours = new ArrayList&lt;T&gt;();

        neighbours.add(vertex[SOME_NUMBER]);

        return neighbours;
    }
}
</code></pre>

<p>Thanks for you help!</p>
