1 2 3 Previous Next 30 Replies Latest reply: Sep 6, 2009 3:26 AM by 807580 Go to original post RSS
      • 30. Re: Hashtable containsKey() problem when String key is read from a file - HELP
        807580
        There's a missing
        if(containsKey(word))
        {
        nextWord = (Hashtable<String, Object>)nextWord.get(word[i]);
        }
        else
        {
        //do what I did
        }
        statement in the for loop. You can delete this thread. 
        I dont think I'm going to post code segments again anyway...
        String output = "||";
                                 
                                 for(int i = 0; i < word.length; i += 1)
                                 {
                                      nextWord.put(word[i], new Hashtable<String, Object>());
                                      nextWord = (Hashtable<String, Object>)nextWord.get(word[i]);
                                      
                                      output += "->" + word[i];
                                      //pg.drawString(output, 50, 50+i);
                                 }
                                 
                                 nextWord.put("Index", info[1]);
                                 output += "->Index{" + info[1] + "}\n";
                                 //pg
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
        1 2 3 Previous Next