Reputation: 981
I have a Seq[Document].
Document has a val field which is a String such that one can do
d.typ ---> which will be a String
I would like to map and filter over the Seq to produce a new Seq of only those Documents whose typ field is equal to a particular string. So far I have this:
def getNewProducts(docs: Seq[Document]):Seq[Document] = {
docs.map(_.typ == "new-product")
}
I understand that I need to provide a predicate filter to the map function but not how to do it. All thanks gratefully received.
Upvotes: 1
Views: 228