Hey,
A BitSet is a set of non-negative integers depicted as arrays. These arrays are variable in size and packed into 64-bit words. The largest number in a BitSet determines its memory footprint.
Let’s take an example:
scala> import scala.collection.immutable._
import scala.collection.immutable._
scala> var nums=BitSet(7,2,4,3,1)
nums: scala.collection.immutable.BitSet = BitSet(1, 2, 3, 4, 7)
scala> nums+=9
scala> nums