Skip to content

Chapter 6 - preserving order of elements in a set #28

@vaclav

Description

@vaclav

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions