I would expect in the code below :
public static <K, D extends List<T>, T> List<Map<K, D>> meth(K k, D d) {
List<Map<K, D>> daBytes = (List<Map<K, D>>)
new ArrayList<Map<K, List<List<Byte>>>>();
// ...
}
the compiler to figure out that D
is a List<List<Byte>>
and/or that T
is a <List<Byte>
- and to actually get rid of the cast. Instead I get :
Cannot cast from ArrayList<Map<K,List<List<Byte>>>> to List<Map<K,D>>
and I need the cast anyway.
Why ? Is what I want somehow possible (without the strategy pattern workaround) ?
>` or a `List` - see code [here](http://stackoverflow.com/q/18749426/281545). So I know it must be a list of something - `?` is no use as it can't be manipulated and anyway I need to assign it to a specific type. Anyway I can do what I want (question 2) ?
– Mr_and_Mrs_D Sep 17 '13 at 20:01