Alessandro Tagliapietra
05/04/2021, 10:45 PM.filter { _key, value ->
value.getTimestamp().isBefore(Instant.now().plusSeconds(600))
}
key
is a string but I don't care what type it is
value
can be multiple types but all implement the getTimestamp method that returns an instant, so I've tried tried to create a file like this:
interface DataWIthTimestamp {
fun getTimestamp(): Instant
}
val filterFutureData: (key: Any, value: DataWIthTimestamp) -> Boolean = { _, value ->
value.getTimestamp().isBefore(Instant.now().plusSeconds(600))
}
which doesn't work as it says
Type mismatch.
Required: Predicate<in String!, in Metric!>!
Found: (Any, DataWIthTimestamp) → Boolean
I know my implementation might not make sense 🙂Nir
05/04/2021, 10:51 PMgetTimestamp
Nir
05/04/2021, 10:51 PMNir
05/04/2021, 10:51 PMcan be multiple types but all implement the getTimestamp method that returns an instant, so I've tried tried to create a file like this:value
fkjdf
Nir
05/04/2021, 10:51 PMNir
05/04/2021, 10:52 PMAlessandro Tagliapietra
05/04/2021, 10:52 PMNir
05/04/2021, 10:52 PMAlessandro Tagliapietra
05/04/2021, 10:52 PMAlessandro Tagliapietra
05/04/2021, 10:53 PMNir
05/04/2021, 10:53 PMNir
05/04/2021, 10:53 PMNir
05/04/2021, 10:53 PMNir
05/04/2021, 10:53 PMNir
05/04/2021, 10:53 PMAlessandro Tagliapietra
05/04/2021, 10:54 PMNir
05/04/2021, 10:54 PMAlessandro Tagliapietra
05/04/2021, 10:54 PMNir
05/04/2021, 10:54 PMNir
05/04/2021, 10:54 PMNir
05/04/2021, 10:55 PMfun filterFutureDate(value: Timestamp) = value.isBefore(Istant.now().plusSeconds(600))
Nir
05/04/2021, 10:55 PM.filter { _, value -> filterFutureDate(value.getTimestamp()) }
Nir
05/04/2021, 10:55 PMvalue.getTimestamp().filterFutureDate()
Nir
05/04/2021, 10:55 PMAlessandro Tagliapietra
05/04/2021, 11:23 PM