Let's not get wrapped up in the threadlocal. How a...
# announcements
m
Let's not get wrapped up in the threadlocal. How about this. I have a consuemr
(T) -> Unit
and a producer
() -> T
. I want to store pairs of those, but with a different
T
for each pair.
d
Put them in individual properties
m
No, I want a collection.
d
The elements retrieved from a collection cannot have a different type at compile time so you're going to need a
Collection<MyPair<*>>
Copy code
class MyPair<T>(collector, producer) {
    fun run() = collector(producer())
}
Copy code
for (pair in pairs) pair.run()
m
yeah, I ended up going with something similar
thanks for teddy-bearing 🙂