What’s the best way to iterate through a map, and filter out certain keys? The pseudocode might be something like
map.foreach(tuple where !list.contains(tuple._1) => { })
Thanks
Bruce
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
But, if this is a huge map and a huge set, then I’d suggest sorting them first and mutually iterating through them, picking off the bits that you need as you go. The repeated calls to
containsmay not perform as well as you’d like, especially if you use aListinstead of aSet.