Scala Mutable SortedSet product() method
Last Updated :
26 Mar, 2020
In Scala mutable collections, SortedSet product() method is utilized to find the product of all the elements of the SortedSet.
Method Definition: def product: A
Return Type: It returns the product of all the elements of the SortedSet.
Example #1:
import scala.collection.mutable.SortedSet
object GfG
{
def main(args : Array[String])
{
val s 1 = SortedSet( 2 , 3 )
val result = s 1 .product
println(result)
}
}
|
Example #2:
import scala.collection.mutable.SortedSet
object GfG
{
def main(args : Array[String])
{
val s 1 = SortedSet( 5 , 4 , 3 , 2 , 1 )
val result = s 1 .product
println(result)
}
}
|
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...