ProgrammingBasics icon indicating copy to clipboard operation
ProgrammingBasics copied to clipboard

Chapter 6 - preserving order of elements in a set

Open vaclav opened this issue 6 years ago • 0 comments

The Sets section:

assert listHalved.toSet.toList.head(3) equals list(0, 1, 2)

Isn't this implementation specific? What guarantees that a list converted to a set and converted back to a list preserves the original order? How about: listHalved.toSet.with(...).without(...).toList also preserve order?

assert listHalved.toList.at(3) equals 2 - here the "toList" conversion is not necessary, right?

vaclav avatar Apr 26 '18 13:04 vaclav