Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Professional Scala

You're reading from   Professional Scala Combine object-oriented and functional programming to build high-performance applications

Arrow left icon
Product type Paperback
Published in Jul 2018
Publisher
ISBN-13 9781789533835
Length 186 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
 Hartmann Hartmann
Author Profile Icon Hartmann
Hartmann
 Shevchenko Shevchenko
Author Profile Icon Shevchenko
Shevchenko
Arrow right icon
View More author details
Toc

Other Collections


Now that we've covered the List and some relevant Traversables in the Scala standard library, we should also visit some other useful collections Scala provides. Even though this section has less theoretical material, this means that we'll have more time on the final activities of the chapter.

Sets

Sets are Iterables that contain no duplicate elements. The Set class provides methods to check for the inclusion of an element in the collection, as well as combining different collections. Note that since Set inherits from Traversable, you can apply all the higher-order functions we've seen previously on it. Due to the nature of its apply method, a Set can be seen as a function of type A => Boolean, which returns true if the element is present in the set, and false otherwise.

Tuples

A tuple is a class capable of containing an arbitrary number of elements of different types. A tuple is created by enclosing its elements in parentheses. A tuple is typed according...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images