Janet is working on Scala Future and map collection concept. Help Janet predict the output for the given code.

(Assume all the necessary imports have been done.)

object ScalaFuture extends App {
 val myList = Future{List('a', 2, "hey", 3)}
 
 val result = myList.map(x => x.apply(3).equals("hey"))
 result.onSuccess {
   case x => println(x)
 }
 result.onFailure {
   case y => println("Error")
 }
}

hey

error

true

false

Verified Answer
Correct Option - d

To get all Infosys Certified Scala Programmer Exam questions Join Telegram Group https://rebrand.ly/lex-telegram-236dee

Telegram