Not sure how to avoid this ClassCastException
<p>The following code throws a ClassCastException. The collection in question actually does hold <code>ArrayList&lt;String&gt;</code>. </p>

<pre><code>HashMap listing = (HashMap) data.get(s);
Collection&lt;ArrayList&lt;String&gt;&gt; collection = listing.entrySet();

int count = 0;


for ( ArrayList al : collection ) // exception occurs here
{
    count += al.size();
}
</code></pre>

<p>I am assuming that this must be converted to Object and </p>

<p>a) I can't seem to figure out how to convert from Object to ArrayList properly</p>

<p>b) I'm not even sure if thats the issue..</p>

<p>Perhaps someone can provide some insight? </p>

<p>Edit: HashMap listing is a <code>HashMap&lt;String, ArrayList&lt;String&gt;&gt;</code></p>
