Lars Vielhauer
05/16/2021, 4:50 PMval map = hashMapOf<Int, Any?>()
println("map.isEmpty() is ${map.isEmpty()}") // true
map[1] = "x"
map[2] = 1.05
// Now map contains something:
println(map) // {1=x, 2=1.05}
From my understanding the last assert is not general enough as the order of elements is not guaranteed, right?
This could maybe be changed to two asserts checking for the two elements separatelyephemient
05/16/2021, 6:17 PMmapOf()
, mutableMapOf()
, and various collection extensions returning Map<>
, but yeah it isn't guaranteed for HashMap
ephemient
05/16/2021, 6:18 PMLars Vielhauer
05/16/2021, 6:28 PMassertPrints(map, "{1=x, 2=1.05}")
So a change in the implementation might break the unit test and therefore fail the buildDave K
06/04/2021, 2:22 AM