开发者

which collection should be efficient for this prob

in my project i have to store some data in the format in the Key=value and later i will just read this value so which colle开发者_JAVA技巧ction will be suite for me . Thanks in Advance


What you're referring to is a Map.

If you're going to always access via key / value, use HashMap. If you intend on cycling through all values, HashMap is horridly inefficient and so you should use LinkedHashMap instead.


There are few things that you need to consider before you make any decision about selecting any decision

  1. Whether the items needs to be ordered
  2. Whether the items needs to be sorted
  3. whether collection needs to be synchronized or not and many more Here is the link where you can get more information about the process of selecting the collection. http://www.javamex.com/tutorials/collections/how_to_choose.shtml


You might want to check out the map interface.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜