#collections #scala #sets
Concatenating Sets:
You can use either ++ operator or Set.++() method to concatenate two or more sets,
If you want to change selection, open document below and click on "Move attachment"
Scala Setsove code is compiled and executed, it produces the following result:
C:/>scalac Test.scala
C:/>scala Test
Head of fruit : apples
Tail of fruit : Set(oranges, pears)
Check if fruit is empty : false
Check if nums is empty : true
C:/>
<span>Concatenating Sets:
You can use either ++ operator or Set.++() method to concatenate two or more sets, but while adding sets it will remove duplicate elements. Following is the example to concatenate two sets:
object Test {
def main(args: Array[String]) {
val fruit1 = Set("a Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details