![]() ![]() Given that definition, here is a list of filtering methods available to Scala sequential collection classes: So, a filtering method will create a subset of the original collection, without changing any of the elements with an algorithm (such as multiplying each element by two, for example). I think of filtering methods as being those methods that filter the original collection into a subset of the original collection, without changing any of the data during the filtering process. Given that data, we can now look at the method categories along with examples of each method. Val names = List("Al", "Christina", "Kim") We’ll get to those examples in just a moment, but to show those examples we’ll first need some sample data to work with: The following lists (and examples) show how I broke up those categories. In another effort to help make sense of the collections methods, I broke them up into different categories of use. In those examples I use c to stand for collection, f to stand for a function, and p to stand for a predicate. The next image shows the beginning of a table that demonstrates the methods that are available on all Traversable collection classes: #Scala collections how to#In another table I show examples of how to call each collection method. For instance, in one recipe on choosing a collection class, I included information like the following table, which is a subset of a larger table: One of the things I tried to do in Chapters 10 and 11 is to make sense and help organize the presentation of the collections classes and methods. That was my goal.Īs a result of this effort - and perhaps to the chagrin of my editor - the Scala collections chapters ended up being 130 pages in length. I thought that if I wrote each recipe as well as possible, and included important recipes in each chapter, well, I wanted each chapter to be worth the price of the entire book. #Scala collections full#When I wrote the Scala Cookbook, I gave each recipe my full attention. (Note: I’m currently in the process of editing this page, so there may be a few errors in the examples and formatting while I do this.) ![]() ![]() show more info on classes/objects in repl. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |