In the previous lesson, you learned how to analyze the properties of a sequence. In this lesson, you’ll discover how to select one item in a list by its position. You’ll also learn how to find an item that has specific characteristics. Finally, you’ll see how to select the minimum or maximum element in a list based on natural ordering or custom ordering criteria. In the capstone, you’ll analyze the movies data set to determine which movie has the highest profit.
Listing 30.1 Representation of a contact
case class Contact(name: String, surname: String, numbers: List[ContactNumber], company: Option[String], email: Option[String]) sealed trait Label case object Work extends Label case object Home extends Label case class ContactNumber(number: String, label: Label)