I want to specify this type:
Map<String,Map<String,String>> blah = null;
But Eclipse refuses this. I am not sure if it is Eclipse or the Java parser.
I had similar issues when trying to write my own java parser at study times: ">>" was regarded as the shift operator.
What's going on here?
Edit: java works for this.
It could be because your eclipse is set up to use a compiler version for java 1.4 which doesn't have generics.
Does it work if you just do
Map<String,String> map = null;
EDIT: Setting in eclipse
No problem for me as expexted...
Indeed you can for sure define nested generic like you was doing
Map<String,Map<String,String>> blah = null;
Event doing this will not cause problems
Map<String,Map<String,Map<String,String>>> blah = null;
It is not a problem of nested generic (Java support this feature), it is a problem of generic support. Be sure to have the right settings for your compiler in Eclipse, you have to set at least java 1.5 for enabling generics. (Windows->Preferences->Java-Compiler and then check the version).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.