Тесты
Язык сайта: Русский
Українська
English
Русский
Тесты по программированию
Вход
Регистрация
Тесты по программированию
Теория
сниппеты
Статьи
Главная
Android
Цены
FAQ
История Cosmo
Правила и условия сервиса
Политика конфиденциальности
Политика в отношении файлов cookie
Обратная Связь
option
:
Язык контента: English
Русский
What will be the result of applying fold to Option in the following code? val number: Option[Int] = Some(3) val noNumber: Option[Int] = None val result1 = number.fold(1)(_ * 3) val result2 = noNumber.fold(1)(_ * 3) println(result1) println(result2)
Option
What will be the result of applying map function to the values of type Option in the following code? val number: Option[Int] = Some(3) val noNumber: Option[Int] = None val result1 = number.map(_ * 1.5) val result2 = noNumber.map(_ * 1.5) println(result1) println(result2)
Option
What will be the result of calling method forall on empty Option? val a = None a.forall(_ == "text")
Option
What will be the result of calling method exists on empty Option? val a = None a.exists(_ == "text")
Option
What will be the result of applying function combine for options, one of which is empty? import cats.implicits._ import cats.kernel.Semigroup Semigroup[Option[Int]].combine(Option(1), None)
Option
← Предыдущая
1
2
Следующая →
Зарегистрируйся сейчас
или
Подпишись на будущие тесты