高级农民
- 积分
- 4642
- 大米
- 颗
- 鳄梨
- 个
- 水井
- 尺
- 蓝莓
- 颗
- 萝卜
- 根
- 小米
- 粒
- 学分
- 个
- 注册时间
- 2014-12-19
- 最后登录
- 1970-1-1
|
写了好久终于写出来了!
贡献一下测试HashTableChained的代码吧。
- System.out.println("=====================size, isEmpty=========================");
- System.out.println("table's size is: " + table.size());
- System.out.println("table is Empty: " + table.isEmpty());
-
- System.out.println("=====================insert================================");
- table.insert("1", "The first one");
- table.insert("2", "The second one");
- table.insert("3", "The third one");
- table.insert("what", "nani?");
- table.insert("the","Eh-heng");
- table.insert("hell!","impolite");
- System.out.println("table's size is: " + table.size());
- System.out.println("table is Empty: " + table.isEmpty());
- try{
- String [] output = table.String();
- for(String s : output){
- if(s != null) System.out.println(s);
- }
- }
- catch(InvalidNodeException ine){
- System.err.println(ine);
- }
-
- System.out.println("====================find, remove===========================");
- Entry e1 = table.find("6");
- if(e1 != null)
- System.out.println("The item found is: [ " + e1.toString() + " ]");
- else
- System.out.println("The is no such item in the table to be found.");
-
- Entry e2 = table.remove("hell!");
- if(e2 != null)
- System.out.println("The item deleted is: [ " + e2.toString() + " ]");
- else
- System.out.println("The is no such item in the table to be deleted.");
-
- try{
- String [] output = table.String();
- for(String s : output){
- if(s != null) System.out.println(s);
- }
- }
- catch(InvalidNodeException ine){
- System.err.println(ine);
- }
-
- System.out.println("=====================makeEmpty=============================");
- table.makeEmpty();
- try{
- String [] output = table.String();
- for(String s : output){
- if(s != null) System.out.println(s);
- }
- }
- catch(InvalidNodeException ine){
- System.err.println(ine);
- }
- */
复制代码 |
 组图打开中,请稍候......
|