Scala Sets Examples

Notes on sets :
– Scala provides mutable and immutable sets. (scala.collection.mutable, scala.collection.immutable )

Sets examples :
– Sets creating, initializating

scala> import scala.collection.mutable.Set
scala> val teniscordVisitorsSet = Set(“Players”, “Watchers”)
scala> tenisCordVisitorsSet += “Referees”

scala>import scala.collection.immutable.HashSet
scala>val tenisCordVisitorsSet = HashSet(“Players”, “Watchers”)

Reference :

1.  Programming in Scala: A Comprehensiv e Step-by-step Guide

Leave a Comment

Your email address will not be published. Required fields are marked *