Quantcast
Browsing all 25 articles
Browse latest View live

How to merge (concatenate) Lists in Scala

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 11.5, “How to Merge (Concatenate) Lists in Scala”ProblemYou want to merge/concatenate the contents of...

View Article


Scala: How to loop over a collection with for and foreach (plus for loop...

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 3.1, “How to loop over a collection with for and foreach (and how a for loop is translated)”ProblemYou...

View Article


How to use Scala for loops with multiple counters

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 3.2, “How to use Scala for loops with multiple counters.”ProblemYou want to create a loop with multiple...

View Article

How to use a Scala 'for' loop with embedded 'if' statements (guards)

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 3.3, “How to use a 'for' loop with embedded 'if' statements (guards).”ProblemYou want to add one or more...

View Article

How to drop the first matching element in a Scala sequence

Summary: This blog post shows one way to drop/filter the first matching element from a Scala sequence (Seq, List, Vector, Array, etc.). I don’t claim that the algorithm is efficient, but it does...

View Article

Browsing all 25 articles
Browse latest View live