 <p>Can't you just create a hash map that has a string key and store whatever numeric value you want? I.e. </p> <pre><code>Map&lt;String, Integer&gt; m = new HashMap&lt;String,Integer&gt;(); m.put(makeKey(3,2), 2); // where makeKey returns something like "[3,2]" </code></pre> <p>EDIT: </p> <p>The downside is you don't have a reliable iteration order, i.e. if you want to iterate over everything in the Nth row or column, there's no easy way to do that efficiently.</p>