Unsafe parameterized ArrayList cast after an instanceof check
<p>Hi guys i got a problem with an unsafe cast operation.
Here is the problem. I gotta Constructor which accepts different types of Orders (PlayList, UserOperations, etc.) or should. So i decided to give it a Parameter as Object and check the type of the received once called. The Problem is one of those is a parameterized ArrayList (<strong>ArrayList &lt; PlayList ></strong>) and since it is impossible to check a parameterized ArrayList I have to "dig" in. At first step i check if it is an ArrayList, at second I go into it an check the type of its content.
The problem afterwards is I get an unsafe cast warning which i dunno yet how to handle.</p>

<p>Greetings</p>

<pre><code>    public Order(int aTyp, Object aOrderContent) {
    this.orderTyp = aTyp;
    if (aOrderContent instanceof ArrayList&lt; ? &gt;) {
        ArrayList&lt;?&gt; objList = (ArrayList&lt; ? &gt;)aOrderContent;
    if (objList.get(0) != null &amp;&amp; (objList.get(0)) instanceof PlayList) {
        playList.addAll((ArrayList&lt;PlayList&gt;)aOrderContent) ;
    }        

    } else if (aOrderContent instanceof UserOP) {

    }
}
</code></pre>
