Javatpoint Logo
Javatpoint Logo

Scala HashSet

HashSet is a sealed class. It extends AbstractSet and immutable Set trait. It uses hash code to store elements.

It neither maintains insertion order nor sorts the elements.


Scala HashSet Example

In the following example, we have created a HashSet to store elements. Here, foreach is used to iterate elements.

Output:

0 
6 
2 
45 
3 
8 
4
Next TopicScala BitSet





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA