Code snippets for scala