39 Working with Either
After reading this lesson, you will be able to
- Retrieve a value wrapped in the left or right side for
Either
- Check if an instance is its left or right projection
- Inquire if its value respects a given predicate
In the previous lesson, you learned the structure of Either
and its basic operations. In this lesson, you’ll learn about other useful methods the class Either
has to offer. They are very similar to the one you saw for Option
. They do not share an interface, but this is a happy consequence of the consistent design and style of the Scala collections. You’ll discover how to retrieve a value defined for its left or right side. You’ll also inquire about its properties to check if a given instance is of type Left
or ...
Get Get Programming with Scala now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.