📄
字号:
/*
* Node.java
*
* Created on 2005年1月6日, 下午11:45
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package com.hashtable;
/**
*
* @author netlab316
*/
public class Node {
String IPAddress;
String port1;
String port2;
/** Creates a new instance of Node */
public Node(String IPAddress,
String port1,
String port2) {
this.IPAddress= IPAddress;
this.port1=port1;
this.port2=port2;
}
public String getIPAddress(){
return this.IPAddress;
}
public String getPort1(){
return this.port1;
}
public String getPort2(){
return this.port2;
}
}
/*
* InfoHashtable.java
*
* Created on 2005年1月6日, 下午11:52
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package com.hashtable;
import java.util.Enumeration;
import java.util.Hashtable;
/**
*
* @author netlab316
*/
public class InfoHashtable {
/** Creates a new instance of InfoHashtable */
public NATInfoHashtable() {
Hashtable<String,Node> pD = new Hashtable<String,Node>();
Node patient=new Node("192.168.0.188","22282","22284");
Node doctor=new Node("192.168.0.168","22222","22224");
pD.put("onePat",patient);
pD.put("oneDoc",doctor);
Node temp;
Enumeration en = pD.elements();
while(en.hasMoreElements()){
temp=(Node) en.nextElement();
System.out.println(temp.getIPAddress()+"--"+temp.getPort1()+"--"+temp.getPort2());
}
}
public static void main(String[] args) {
// TODO code application logic here
new InfoHashtable();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -