Javatpoint Logo
Javatpoint Logo

Scala BitSet

Bitsets are sets of non-negative integers which are represented as variable-size arrays of bits packed into 64-bit words. The memory footprint of a bitset is determined by the largest number stored in it. It extends Set trait.


Scala BitSet Example

Output:

0
1
5
6
8
9

Scala BitSet Example: Adding and Removing Elements

You can perform basic operations like adding and deleting in the bitset. In the following example, we have applied these operations.

Output:

0 1 5 6 8 9 
After adding 20: 0 1 5 6 8 9 20 
After deleting 0: 1 5 6 8 9 20
Next TopicScala ListSet




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA