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
- Whether the items needs to be ordered
- Whether the items needs to be sorted
- 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.
精彩评论