我試圖運行代碼我得到「UnsuportedOperationException」時設立地方使用的數據結構將確定一個字符串中的參數::多個構造與相同參數
DictionaryI<IPAddress,String> ipD; //declaring main structure using interface
// Constructor, the type of dictionary to use (hash, linkedlist, array)
// and the initial size of the supporting dictionary
public IPManager(String dictionaryType, int initialSize){
if(st1.equals(dictionaryType))
ipD = new LinkedListDictionary();
if(st2.equals(dictionaryType))
ipD = new HashDictionary(initialSize);
if(st3.equals(dictionaryType))
ipD = new ArrayDictionary(initialSize);
else
throw new UnsupportedOperationException();
}
構造不管我輸入什麼東西。任何幫助或正確的方向點將不勝感激! (代碼是Java)
小心給我們st1,st2和st3? – 2012-04-03 03:14:25
st1 =「linkedlist」 st2 =「hash」 st3 =「array」 – JeffS 2012-04-03 17:01:26