Product3 is a trait in Scala, which is a Cartesian product of three elements. The Linear Supertypes here are
Product,
Equals, and
Any and the known subclass here is
Tuple3. It extends the trait
Product i.e,
trait Product3[+T1, +T2, +T3] extends Product
Where, T1, T2, and T3 are the used parameter types of the Scala.
-
Abstract Value Members
The abstract value members here are:
Example :
Output:
GeeksforGeeks
32
43.0
Here, we have utilized abstract value members for accessing the elements.
- Concrete Value Members
The concrete value members here are:
-
def productArity: Int
It returns the number of parameters in Product3 trait.
def productElement(n: Int): Any
It returns nth element.
def productIterator: Iterator[Any]
It returns an iterator by default.
def productPrefix: String
It returns the empty string by default.
Example :
Here, productPrefix will return Tuple3 as Tuple3 is a final case class that extents Product3.