Jump to content
  • Advertisement
Sign in to follow this  
Schnozzinkobenstein

Java - Cannot instantiate the type...

This topic is 3160 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!