In Java (5+) you can do:
TreeMap<String, List> map = someObject.getMap();
But can specify the generic type within the List
? A la:
TreeMap<String, List<String>> map = someObject.getMap();
??
In Java (5+) you can do:
TreeMap<String, List> map = someObject.getMap();
But can specify the generic type within the List
? A la:
TreeMap<String, List<String>> map = someObject.getMap();
??
Yes you can. Do you have a compiler error in your code you want help fixing?
Yes,why not? But keep in mind that the type gets erased in the compiled code, so isn't runtime available. That can be a problem if you access it with reflection.
You can nest generic types to arbitrary number of levels. E.g :
TreeMap<String, List<Map<String, String>>>