开发者

what is the java correponding collection to Dictionary<string, string>

开发者 https://www.devze.com 2023-02-16 17:07 出处:网络
coming from .Net world, just want to know what is the corresponding collection to .Net Dictio开发者_运维知识库naryProbably:

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.

0

精彩评论

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

关注公众号