28.08.2016 Views

scala_tutorial

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Scala<br />

Basic Operations on set ..................................................................................................................... 115<br />

Find max, min elements in set ........................................................................................................... 117<br />

Find Common Values Insets ............................................................................................................... 118<br />

Scala Map [K, V] ................................................................................................................................ 122<br />

Concatenating Maps .......................................................................................................................... 124<br />

Print Keys and Values from a Map ..................................................................................................... 125<br />

Check for a key in Map ...................................................................................................................... 126<br />

Scala Map Methods ........................................................................................................................... 127<br />

Scala Tuples ....................................................................................................................................... 131<br />

Iterate over the Tuple ........................................................................................................................ 132<br />

Converting to String ........................................................................................................................... 133<br />

Scala Options ..................................................................................................................................... 134<br />

Using getOrElse() Method ................................................................................................................. 136<br />

Using isEmpty() Method .................................................................................................................... 137<br />

Scala Option Methods ....................................................................................................................... 137<br />

Scala Iterators ................................................................................................................................... 139<br />

Find Min & Max values Element ........................................................................................................ 140<br />

Find the length of the Iterator ........................................................................................................... 140<br />

Scala Iterator Methods ...................................................................................................................... 141<br />

16. SCALA – TRAITS .............................................................................................................. 146<br />

Value classes and Universal traits ...................................................................................................... 148<br />

When to Use Traits? .......................................................................................................................... 148<br />

17. SCALA – PATTERN MATCHING ........................................................................................ 150<br />

Matching using case Classes .............................................................................................................. 151<br />

18. SCALA – REGULAR EXPRESSIONNS ................................................................................. 154<br />

Forming Regular Expressions ............................................................................................................. 156<br />

vi

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!