Sunday, September 07, 2014

word counts in scala

http://bcomposes.wordpress.com/2011/09/19/first-steps-in-scala-for-beginning-programmers-part-8/
http://stackoverflow.com/questions/15487413/scala-beginners-simplest-way-to-count-words-in-file


scala> val counts = holmes.split("\\s+").groupBy(x=>x).mapValues(x=>x.length)

No comments:

Related Posts Plugin for WordPress, Blogger...