Question: In the below example, I want the Element object to keep track of list of threads who have "marked" the elements. The field variable `name` cannot be changed unless no thread is in the `markedThreadList`. Thread can mark or unmark itself on this element, which adds or removes the thread from the list.

```
class Element {
    private String name;
    private LinkedList<?> 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;
        }
    }
}

```

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?

Answer: 
A thread is an instance of `java.lang.Thread`. Use a `Set<Thread>` (rather than a List). You can access the current thread using `Thread.currentThread()`.
Perhaps you want to call [`Thread.currentThread()`](http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Thread.html#currentThread%28%29), which returns a `Thread`?