Logo

Programming-Idioms

History of Idiom 118 > diff from v32 to v33

Edit summary for version 33 by Debaran:
[Scala] Added explanation

Version 32

2019-02-02, 02:09:23

Version 33

2019-02-02, 03:14:54

Idiom #118 List to set

Create set y from list x.
x may contain duplicates. y is unordered and has no repeated values.

Illustration

Idiom #118 List to set

Create set y from list x.
x may contain duplicates. y is unordered and has no repeated values.

Illustration
Code
val y = x.toSet()
Code
val y = x.toSet()
Comments bubble
The default implementation of Set is a HashSet