Colton Idle
05/17/2024, 7:34 PMList<Person>
but I want to filter out if Person.socialSecurityNumber
is null. Easy.
But what If I want to log each time that filter is hit. Essentially we're trying to be proactive about catching cases where socialSecurityNumber is null because it should "never" be.Colton Idle
05/17/2024, 7:37 PMpeople
.filter(predicate = { it.social != null }
but in an ideal world, I kinda want is this?
people
.filter(predicate = { it.social != null }, predicateFailedSideEffect = { Sentry.log(it.id) })
Shawn
05/17/2024, 7:56 PMShawn
05/17/2024, 8:09 PMval peopleWithSsns = people.partition { it.ssn != null }
.apply { second.forEach { Sentry.log(it.id) } }
.first
José González D'Amico
05/17/2024, 8:11 PMit should "never" be
? what about illegal inmigrants?Javier
05/18/2024, 11:53 AMpeople
.onEach { if (it.social == null) log(...) }
.filter { it.social != null }