Let’s say we are filtering a list of strings and want to create a log entry if a string has been filtered out:
val strings = IndexedSeq("foo", "", "bar")
val filtered = strings.filter(string => {
if (string.isEmpty) {
logger.trace("value ignored")
false
} else {
true
}
})
What is the best way to find out which element of the sequence has been ignored to add this information to the logfile?