再给你一段document: 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.
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);