How to created 2d array/arraylist with different types of data in each dimension in JAVA?
<p>I have a native Android news App where I have news articles and comments under each article.</p>

<p>When I open the inner View(Activity) of any specific article there might be different coverages of the same article, e.g. the Coverage from CNN, BBC, FOX ...etc.</p>

<p>Each coverage is actually treated as a different article with Unique String ID/Hash.</p>

<p>My background is Perl/PHP I'd like to know how do I create something like this in java:</p>

<pre><code>$array["Article1_Coverage_X"] = array($Comment1,$Comment2,$Comment3);
$array["Article1_Coverage_Y"] = array($Comment1,$Comment2,$Comment3,$Comment4);
// $Comment1 , $Comment2 ....etc are comment objects
</code></pre>

<p>.
.
i.e. the first dimension of the array is a string(key) and the 2nd dimension is of other type</p>

<p>I tried the following but it's not what I'm looking for:</p>

<pre><code> ArrayList&lt;ArrayList&lt;Comment&gt;&gt;  // Where Comment is a Java object with ID,Title.....etc
</code></pre>

<p>As the keys for both dimension are indexed integers</p>

<p>if there's a better approach I'd highly appreciate it.
I want to store the list of comments related to each news article in a temporary variable such that it's (recycled/thrown to garbage) once the user quits the Activity, that's why I don't wanna store in an SQLite db.</p>
