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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.