This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Because generics in Java don't work that way. You can't assign an array of EnumMap<T, U> to an array of Map<T, U>.
Actually you can, once you are able to create one. Because Map is a super type of EnumMap, Map is a super type of EnumMap.
Creating the array is the problem, because generics don't allow you to create arrays of generic types. The reason is because the compiler cannot guarantee type safety anymore. Consider, assuming line 1 would not create a compiler error:
With non-generic types line 3 would have already created a ClassCastException, and therefore it's easier to find the cause of the problem. In this case the ClassCastException comes at a point where you no longer know why it went wrong.
Anyway, with only one compiler warning you can create the values map: