31 Working with List: Filtering

After reading this lesson, you will be able to

  • Remove or select items from a sequence based on their position
  • Filter elements of a list that respect a given predicate
  • Remove duplicated items in a sequence

In the previous lesson, you learned how to select a single element in a sequence based on its position or features. In this lesson, you’ll continue to discover other operations you can perform on an instance of List. You’ll see how to create a new list from an existing one by selecting one of its subsections. You’ll discover how to pick elements that have specific characteristics. Finally, you’ll learn how to create a new sequence that contains no duplicated items. In the capstone, you’ll use these operations ...

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.