You are using your LinkedList
from multiple threads. The javadoc of LinkedList
clearly states (in bold) that:
Note that this implementation is not synchronized. If multiple threads access a linked list concurrently, and at least one of the threads modifies the list structurally, it must be synchronized externally.
Your thread name "scares" me:
Exception in thread "Thread-742" java.lang.NullPointerException
It looks you have many (hundreds?) of threads. You access LinkedList
concurrently and chances are high that its internal state gets corrupted.
Then Collections.frequency()
tries to go over the list using its iterator which hits a null
value in its implementation probably due to LinkedList
being corrupted.
Don't use the LinkedList
from multiple threads without proper synchronization.