Is there no way to iterate over or copy all the values of a Java ThreadLocal?
Posted
by Jonas N
on Stack Overflow
See other posts from Stack Overflow
or by Jonas N
Published on 2010-05-08T20:06:55Z
Indexed on
2010/05/08
20:18 UTC
Read the original article
Hit count: 172
Context:
static ThreadLocal<MyType> threadLocalMyType = ...
What i'd like is to say something like:
for (ThreadLocalEntry e: threadLocalMyType.getMapLikeThing() {
// Thread t = e.getKey();
// I don't need the thread value right now, but it might be useful for
// something else.
MyType theMyType = e.getValue();
// [...do something with theMyType...]
}
© Stack Overflow or respective owner