Question: In C#

```
Dictionary<String, String> dictionary = new Dictionary<String, String>();

```

In Java, this errors with 

> 
> Cannot instantiate the type
>  Dictionary
> 
> 
> 

What could be wrong?

In my code this follows with 

```
dictionary.put("vZip", jsonUdeals.getString("vZip"));

```

I know this sounds too trivial. But I am at a loss!  

If Dictionary doesn't do it(which I strongly suspect by now), then which DataStructure to use.

Answer: 
[`Dictionary`](http://download.oracle.com/javase/1.5.0/docs/api/java/util/Dictionary.html) is an abstract class in Java. It is also obsolete; you should use the `Map` interface instead; something like:

```
Map<String,String> map = new HashMap<String,String>();

```

Note that [`HashMap<K,V>`](http://download.oracle.com/javase/1.5.0/docs/api/java/util/HashMap.html) is a concrete class, but we're assigning it to a [`Map<K,V>`](http://download.oracle.com/javase/1.5.0/docs/api/java/util/Map.html) reference, which is an interface. This is the recommended style in Java, because it allows you to switch `HashMap` for e.g. `Hashtable` at a later stage, without having to change everything.
Use a HashMap as follows:

```
Map<String, String> dictionary = new HashMap<String, String>();

```