I have some code that does this = :
{
val data = someBlackBox.loadData()
LOG.(s"Got ${data.size} record(s)")
data
}
Three lines seems a bit inelegant when all I want to do is log the size of the data (a Set
) and return the data. Is there someMethod
on Set
where:
someBlackBox.loadData().someMethod(data => LOG(s"Got ${data.size} record(s)"))
...so someMethod
works a bit like map
but isn't intended to transform data
into another type - merely perform some operation on it, and return it?
Or maybe an altogether better way of doing this?