x | } res0: List[Int] = List(1), 2.scala> List(1, "1") map { | case x: Int => x | case y: String => y.toInt | }, 3.scala> List(1, "1") filter { | case x: Int => true | case _ => false | }, 4.All of the above">
MCQs > IT & Programming > Scala > Which code example of Scala collection type for filter is correct?

Scala MCQs

Which one of the following code example of Scala collection type for filter is correct?

Answer

Correct Answer: scala> List(1, "1") collect { | case x: Int => x | } res0: List[Int] = List(1)

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Scala Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Scala Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it