Hello. In this section, we're going to learn about querying collections. What do we mean by querying collections? As we'll see in this section, there are a number of methods on collections that allow us to get various bits of information about that collection. For example, we could get the number of elements in the collection, or we could reduce the collection to just the elements that match a particular predicate. There are a number of methods on collections that allow us to query simple properties of the collection, such as the number of elements it contains. Here are some of them. There is the size method that returns the number of elements in the collection, isEmpty, it returns true if there are no elements in the collection, and the opposite, nonEmpty, which returns true if there are elements in the collection, and contains, which returns true if the collection contains a particular element. That element is given as a parameter to the method. Note that when we call contains on a Map, we pass an example of a key, not a value. The method will return true if the Map contains that key. That is, it has a value mapped to that key within it. Find and filter are two other very useful methods on collections. Find returns the first element that matches the predicate, and filter returns all of the elements that match a predicate. This leads the question, what do we mean by a predicate? A predicate is simply a function that returns a boolean, true or false. In the case of find and filter, we're passing the function elements from the collection, and it returns true if the element is one that we're interested in. We have two examples here. First example, we're calling find, and the predicate is looking for numbers that are evenly divisible by two, in other words, even numbers. Find returns the first element that matches the predicate. In this case, we get the results two. Filter is going to return all of the elements that match a predicate. We're using the same predicate here, looking for even numbers, and the result is two and four, all the elements that match that predicate. You may have noticed that the return value from find is something we haven't seen before. What find returns is an option, and it's about time we learned about them, which is what we're going to do next. In a future section, we're going to go into a lot of detail about option. For now, just know that option is a special collection that holds zero or one element. Therefore, we can use it to represent an optional value, a value that might be missing. There are two cases to option. The some case, when we have a value and the none case when there are no value. Find is a good example of something that returns an option. We may not find the value we're looking for, so by returning an option, we can indicate that there is no value available. We have an example here, calling find and in this case, the predicate is looking for values equal to one. There is such a value, and so the result is some containing one. In the second case here. We calling find and this time the predicate is looking for values equal to five. There is no value that matches five, so the result, in this case, is none, which indicates no value is available. That is it for querying collections. To recap, the size method gets a number of elements in the collection. isEmpty and nonEmpty can be used to determine if a collection is empty or not. Contains will test if the element is contained within a collection. Find will return the first element that matches the predicate, and filter will return all of the elements that match a predicate in a collection that's the same type as the collection in which we call the filter method. We've also briefly looked at option. There are many other filtering methods that we don't have time to discuss here. Do check out the API documentation for more. There's a lot going on in the collections library, which may make it hard to learn at first, but it does become very powerful once you're familiar with it.