what is the java correponding collection to Dictionary<string, string>
coming from .Net world, just want to know what is the corresponding collection to .Net Dictio开发者_运维知识库nary
Probably:
Map<String, String> map
If you want ordered keys:
map = new TreeMap<String, String>();
If you want O(1) ops instead of O(lg n):
map = new HashMap<String, String>();
Interface Map<String,String>
, implementation classes HashMap<String,String>
or TreeMap<String,String>
You clould use java.util.Properties which extends Hashtable
and uses String
as key and value type.
精彩评论