I have created one linked hash map and then using that map I have generated Map key array like this : -
Map<String, String> map = new LinkedHashMap<>();
map.put("Str1", "Str1");
map.put("Str1", "Str1");
String[] keyArray= map.keySet().stream.toArray(String[]::new);
Now, the question is what will be the order of keyArray ? Is it the same as inserrtion order of linked hashmap or different? If it is different then how can we generate an array with same insertion order which linkedhashmap has ?