I am totally new to scala and I am having trouble understanding how I can use functions like map() or foreach() to perform operations on strings.
In particular, I am trying to extract all unique contiguous substrings of length k from a string (called k-shingles). My function kshingles(s: String, k: Int) called on the string "abcdab" should return Set("ab", "bc", "cd", "da").
How can I achieve that in scala? A bonus would be to do it in a way that it can be parallelized (e.g. using Spark)