DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Underscore in Scala


val name = "abc" println(name.exists(_.isUpper))

Here "_.isUpper" is an anoymous function, which equals to "x => x.isUpper".

Ref: Scala placeholder syntax Anonymous Function Syntax Scala underscore magic



Published

Aug 13, 2014

Last Updated

Aug 13, 2014

Category

Tech

Tags

  • scala 20
  • underscore 2

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor