Scala - Demonstrate the distinct, intersect, and diff methods Code Example

The code for Demonstrate the distinct, intersect, and diff methods

// distinct method
var result = "IncludeHelp".distinct
println(result)

// intersect  method
var a = "Include"
var b = "Help"

result = a intersect b
println(result)
result = b intersect a
println(result)

// diff method
a = "Hello, world!"
b = "Code Examples"

result = a diff b
println(result)

result = b diff a
println(result)

/*
Output:
IncludeHp
le
el
Hl,worl!
CExampes
*/
Code by IncludeHelp, on August 10, 2022 23:47

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.