Functional SaveObject in Scala
You are mixing a repository with a classifier. The classifier is not doing anything except separating out keys from non-keys. The repository doesn't do anything with what it holds. You convert strings to a particular type and then store them back as strings, without gaining any real value along the way.

DDType doesn't seem to do anything except act as a classifier. And it doesn't even do that, as it only translates the string values "text", "numeric", etc, into predicates which are then discarded at the end of the classification.

Without seeing the use case, I can only presume that add(dd) is called from time to time and the sets are updated, either into keys or into inserts.


keys and inserts can be variables that hold immutable Sets. That will improve thread safety a smidgen.
Remove the redundant classifer:

def add(dd:DomainDictionary, value:String) = {
  dd.domainDictionaryType match {
    case "numeric" =&gt; keys = keys + (dd, value.toInt)
    case _ =&gt; inserts = inserts + (dd, value)
  }
}

For full thread safety, use a Repository Pattern, or use Actors.