private <K, V> V[] getMapValuesAsArray(Map<K, V> map) {
V[] valueArray= new V[map.entrySet().size()];
int count=0;
for(Map.Entry<K, V> entry : map.entrySet()) {
valueArray[count] = entry.getValue();
count++;
}
return valueArray;
}
In the above code,
Why cannot the below line be allowed in java?
V[] valueArray= new V[map.entrySet().size()];
