How expensive is a call to java.util.HashMap.keySet()?
<p>I implemented a sparse matrix as <code>List&lt;Map&lt;Integer,Double&gt;&gt;</code>.<br>
To get all entries of row i I call <code>list.get(i).keySet()</code>. How expensive is this call?  </p>

<p>I also used the trove library for an alternative implementation as <code>List&lt;TIntDoubleHashMap&gt;</code>.<br>
What's the cost of calling <code>list.get(i).keys()</code>, here?</p>

<p>Do you have any further ideas of how to implement an efficient sparse matrix?<br>
Or can you provide a list of existing implementations in java?</p>
