输出格式为:Plain=w=b~|~t=e~|~e=c~|~r=d~|~q=a
代码如下:
package ccc;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
import org.omg.CORBA.Request;
public class Text {
public static void main(String[] args) {
Map map = new HashMap();
map.put("q", "a");
map.put("w", "b");
map.put("e", "c");
map.put("r", "d");
map.put("t", "e");
Iterator it = map.keySet().iterator();
StringBuffer Plain1 = new StringBuffer();
while(it.hasNext()){
String key = (String) it.next();
Plain1.append(key+"="+map.get(key)) ;
if(it.hasNext()){
Plain1.append("~|~");
}
}
}
}
运行结果:Plain=w=b~|~t=e~|~e=c~|~r=d~|~q=a