我试图运行代码我得到“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