Java HashTable null pointer exception
<p>i am building a server to sends questions to clients and then receive answer from them, but when i send a question to a client i want to make it as unaviable for sending again for one hour, i mean after i send a question to client , i want for one hour that question will never sends to any other clients,</p>

<pre><code>static Hashtable&lt;Integer, List&lt;Integer&gt;&gt; unavialbeQuestions =
new Hashtable&lt;Integer, List&lt;Integer&gt;&gt;();
</code></pre>

<p>the key is the clientID, the value is list of the IDs of questions that will never send to that client in one hour, this function i used to make question as unaivalble </p>

<pre><code>public void setUnavialbeQuestion(final String cellName, final int questionID) {
        List&lt;Integer&gt; cells = getCellsIntersectedWithCell(cellName);
        int cellID = getCellID(cellName);
        cells.add(cellID);
        for (int i = 0; i &lt; cells.size(); i++) {
            if (unavialbeQuestions.containsKey(cellID)) {
                unavialbeQuestions.get(cells.get(i)).add(questionID);
            } else {
                List&lt;Integer&gt; lll = new LinkedList&lt;Integer&gt;();
                lll.add(questionID);
                unavialbeQuestions.put(cellID, lll);
            }
            Timer timer = new Timer();
            timer.schedule(new TimerTask() {
                @Override
                public void run() {
                    // TODO Auto-generated method stub
                    f(cellName, questionID);
                }
            }, 1000 * 120);
        }
    }
</code></pre>

<p>see the function <code>f()</code> that will fired after one hour (in my demo just 2mins), here is the problem, i got null pointer exception when executing the <code>f()</code> function:</p>

<pre><code>protected void f(String cellName, int questionDI) {
        // TODO Auto-generated method stub
        List&lt;Integer&gt; cells = getCellsIntersectedWithCell(cellName);
        int cellID = getCellID(cellName);
        cells.add(cellID);

        for(int i=0;i&lt;cells.size();i++){
            int index = unavialbeQuestions.get(cells.get(i)).indexOf(questionDI);
            unavialbeQuestions.get(cells.get(i)).remove(index);
        }
    }
</code></pre>

<p>the exception on the <code>index</code> parameter,
what am i doing wrong?</p>
