How expensive is a call to java.util.HashMap.keySet()?

Posted by fx42 on Stack Overflow See other posts from Stack Overflow or by fx42
Published on 2010-04-08T13:53:13Z Indexed on 2010/04/08 14:03 UTC
Read the original article Hit count: 108

Filed under:

I implemented a sparse matrix as List<Map<Integer,Double>>.
To get all entries of row i I call list.get(i).keySet(). How expensive is this call?

I also used the trove library for an alternative implementation as List<TIntDoubleHashMap>.
What's the cost of calling list.get(i).keys(), here?

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

© Stack Overflow or respective owner

Related posts about java