Desmond
Desmond

Reputation: 13

Which is most memory efficient to store map in java?

I have to store key value pairs in java which is more memory efficient and which is more time efficient while reading and writing directly in file?

  1. Table in guava <string,double,double>
  2. map in guava <string,object> where object contain two double values.
  3. Hashmap in java <string,object> where object contain two double values.

also you can suggest some other methods.

Upvotes: 1

Views: 1421

Answers (1)

Peter Lawrey
Peter Lawrey

Reputation: 533750

The most efficient is likely to be Map<String, double[]> Whether you use Guava or not I don't imagine making much difference.

Upvotes: 8

Related Questions