Logo

Programming-Idioms

History of Idiom 118 > diff from v33 to v34

Edit summary for version 34 by Debaran:
[Scala] Parens are erroneous

Version 33

2019-02-02, 03:14:54

Version 34

2019-02-02, 05:08:30

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
Comments bubble
The default implementation of Set is a HashSet