I have this ArrayList in Java -
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
To convert it to an array I invoke list.toArray()
method, but it returns Object[]
. This is not what I want. I want Map<String, Object>[]
.
I know about List.toArray(T[] a);
It doesn't work with parameterized types.
The method signature of batchUpdate method in Spring framework is this -
int[] org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.batchUpdate(String sql, Map<String, ?>[] batchValues)
If it is not possible to create array of Map objects why is Spring using it? And how are we supposed to use this method then?