Questions

  1. What would be the proper effect to represent getting the first element of a list, such as a list of tweets? What about a user's information from the database for a given userId
  2. What are the range of possible values of the following expressionOption(scala.util.Random.nextInt(10)).fold(9)(_-1)?
  3. What will be the result of the following expression?
Try[Int](throw new OutOfMemoryError()).filter(_ > 10).recover {
case _: OutOfMemoryError => 100
}
  1. Describe the result of the following expression:
Future[Int](throw new OutOfMemoryError()).filter(_ > 10).recover {
case _: OutOfMemoryError => 100
}(20)
  1. Given the following function, what would be the result of the following call: either(1)
def either(i: Int): Boolean = 
Either.cond(i > 10, i * 10, new IllegalArgumentException("Give me more")).forall(_ < 100)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.15.161