我想存儲數據,並把它找回來基於他們ids.The數據類型是數據。存儲和獲取基於其ID
int Q_ID -------> Id of the Question
int Type_Question ----> Which type is the Question
ArrayList<String> Options ----> The options are multiple and are determined at run based on users selection of the options
現在我想存儲數據。例如以這種方式。有沒有一種方法可以存儲它們,以便當我輸入Q_ID = 0和Type_Question = 1時;它只返回手泵,如果輸入Q_ID = 1和Type_question = 1,它只返回隨機答案。 這可能太明顯了,但我想不出任何事情。任何想法?
不同的數據結構適用於不同的事情。爲了高效查找,您需要一個「字典」數據結構。 Java中的優秀候選人是[Map](http://docs.oracle.com/javase/tutorial/collections/interfaces/map.html),例如「HashMap <>」。 – FoggyDay 2014-10-31 21:05:33
非常感謝我已經解決了它的建議:) – 2014-10-31 21:37:41