How can store list of threads to a list in Java?
<p>In the below example, I want the Element object to keep track of list of threads who have "marked" the elements. The field variable <code>name</code> cannot be changed unless no thread is in the <code>markedThreadList</code>. Thread can mark or unmark itself on this element, which adds or removes the thread from the list.</p>

<pre><code>class Element {
    private String name;
    private LinkedList&lt;?&gt; markedThreadList; //list of threads who have marked
    public mark(){
        //add the thread to the markedThreadList
    }

    public unmark(){
        //caller thread removes itself from the markedThreadList
    }

    public void setName(String name){ 
        if(markedThreadList.size()==0){
            this.name = name;
        }
    }
}
</code></pre>

<p>My question is, how can I store the thread lists? What type should I use to store them? Should I just give unique integers to each thread when it starts running, and use that information?</p>
