Scala code to perform operations on collections.