Sign in to follow this  
Schnozzinkobenstein

Java - Cannot instantiate the type...

Recommended Posts

There is probably some data structure that I could be using that would be better than this, but nothing is coming to mind. But anyway, I'm getting this error: "Cannot instantiate the type Map<String,LinkedList<String>>" and I'm not sure why.
package main;
import java.util.LinkedList;
import java.util.Map;

public class Main {
	private Map<String, LinkedList<String>> a;
	private int MAX_SIZE;
	public void main(String[] args) {
		a=new Map<String, LinkedList<String>>();

...
...
bla bla bla

The abominatin of a data structure that I have created is being used to store a combination of both Strings and Doubles in a hash table that needs to be able to store the Doubles in order at each key along with an identifier for that value (each one has an identifier). For example, I might store "AX" and the value 1.42 at hash key "A" as "AX1.42" along with "2.999" and "MD6.705". The MD would need to be inserted before the AX, as it is a larger value.

Share this post


Link to post
Share on other sites
Map is an interface, not a class. It describes how mappings behave, but is not itself an implementation of a mapping. It sounds like you might want a HashMap.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this