I'd like to convert the entrySet()
of an Map<String, Statistic>
to an array
(or ArrayList).
I tried:
Map.Entry<String, Statistic>[] entries = statisticMap.entrySet().toArray(new Map.Entry<String, Statistic>[0]);
but this gives the compiler error: "Cannot create a generic array of Map.Entry"
Even this does not work, with same error:
Map.Entry<String, Statistic>[] entries = new Map.Entry<String, Statistic>[1];
But this works:
Map.Entry[] entries = new Map.Entry[1];
Any ideas how to create such a array or list?