简体   繁体   中英

Can a custom hashtable be converted to an array


 QuestionsHash qa = new QuestionsHash(8);

  while (tokens.hasMoreTokens() == true) {
                    ques = tokens.nextToken();
                    ans = tokens.nextToken();
                    qa.put(ques, ans);
                    System.out.println(qa.getQues(ques) );
             
                }

Say I have 15 questions stored in that variable qa . I populated the variable via a hash function . Can I now convert that qa back to an array?

Hope I am making sense with my question

I'm unsure of the methods inside of QuestionHash. If QuestionHash extends Hashtable, you can get the keys or values from the Hashtable by using the method, getKeys() or getValues() from the instance of Hashtable. That should give you enough to convert it to an Array.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM