A validation problem

We need to validate incoming data. Consider an online banking application. Users have already registered and their passwords are with the bank.

The bank security team changed their requirements, so each password must now have at least six characters and a mix of upper and lowercase letters. We need to pull out the already existing passwords and see if these qualify with the new rules.

So, given a list of password strings, we need to compute a corresponding list of Booleans that will return true if the password qualifies, and otherwise false. In other words, given this list of password strings, we need a Tuple2(List[String], List[Boolean]).

Setting the stage

The following is the example list of passwords:

scala> val passwords ...

Get Scala Functional Programming Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.