user496949
user496949

Reputation: 86135

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 Dictionary

Upvotes: 3

Views: 4330

Answers (3)

DerMike
DerMike

Reputation: 16190

You clould use java.util.Properties which extends Hashtable and uses String as key and value type.

Upvotes: 0

James
James

Reputation: 8586

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>();

Upvotes: 7

Jim Garrison
Jim Garrison

Reputation: 86774

Interface Map<String,String>, implementation classes HashMap<String,String> or TreeMap<String,String>

Upvotes: 2

Related Questions