用enumeration是不能修改它里面的内容的,并且一旦循环检索完毕,
enumeration就被释放了,甚至不能重新检索。所以如果要修改,
应该直接修改books
enumeration就被释放了,甚至不能重新检索。所以如果要修改,
应该直接修改books
解决方案 »
- JTree 根据叶节点值 查找该叶节点 并设置该叶节点闪烁
- 急!急!急!用java在网页中添加图形的问题
- java 连接Mysql问题?帮忙看看,谢谢啦!
- 如何在java applet里面用drawString()正确显示中文
- 请教:一个没理由出现的怪问题
- 救救我吧(访问数据库的中文问题)
- 那里可以找到java的svg解释器?
- 基本数据类型转换long------>float,对内存感兴趣的请进!
- 求助:"错误:com/borland/jbcl/layout/XYLayout"应如何解决?
- java程序运行初级问题,求助,急,因为太简单了!!
- applet间的通讯
- Java在手机程序上的前景如何?
NOTE: The functionality of this interface is duplicated by the Iterator interface. In addition, Iterator adds an optional remove operation, and has shorter method names. New implementations should consider using Iterator in preference to Enumeration.
books.addElement("id=2828828bf7ae5d6000f7ae5f9da0000b name=Lance Lavandowska description= url=http://brainopolis.dnsalias.com/roller/page/lance/ weight=0 riority=0 folderId=image= feedUrl=null");
books.addElement("id=2828828bf7ae5d6000f7ae5f9da0001b name=Lance Lavandowska description= url=http://brainopolis.dnsalias.com/roller/page/lance/ weight=0 riority=0 folderId=image= feedUrl=null");
books.addElement("id=2828828bf7ae5d6000f7ae5f9da0002b name=Lance Lavandowska description= url=http://brainopolis.dnsalias.com/roller/page/lance/ weight=0 riority=0 folderId=image= feedUrl=null");
books.addElement("id=2828828bf7ae5d6000f7ae5f9da0003b name=Lance Lavandowska description= url=http://brainopolis.dnsalias.com/roller/page/lance/ weight=0 riority=0 folderId=image= feedUrl=null");
books.addElement("id=2828828bf7ae5d6000f7ae5f9da0004b name=Lance Lavandowska description= url=http://brainopolis.dnsalias.com/roller/page/lance/ weight=0 riority=0 folderId=image= feedUrl=null");
books.addElement("id=2828828bf7ae5d6000f7ae5f9da0005b name=Lance Lavandowska description= url=http://brainopolis.dnsalias.com/roller/page/lance/ weight=0 riority=0 folderId=image= feedUrl=null");
//...
String target="2828828bf7ae5d6000f7ae5f9da0000b";
Enumeration bookEnum = books.elements();
String content="";
int pos=0;
Object obj;
String id="";
while(bookEnum.hasMoreElements()){
obj=bookEnum.nextElement();
content=(String)obj;
id=content.substring(content.indexOf("=")+1,content.indexOf(" "));
if(id.equals(target)){
pos=books.indexOf(obj);
System.out.println (id);
break;
}
}
books.remove(obj);
//...修改content以后
books.add(content);