Java - Cannot instantiate the type...

Started by
1 comment, last by Schnozzinkobenstein 14 years, 1 month ago
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.
--------------------Configuration: error maker - Win32 Debug--------------------Compiling...error maker.cppLinking...error maker.exe - 1 error(s), 0 warning(s)
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.
Yep. That's what it was. Thanks!
--------------------Configuration: error maker - Win32 Debug--------------------Compiling...error maker.cppLinking...error maker.exe - 1 error(s), 0 warning(s)

This topic is closed to new replies.

Advertisement