曙光XK

Enumeration 接口

Enumeration是遍历集合元素的一种方法。

Enumeration中只有两个方法:

1.hasMoreElements()  测试此枚举是否包含更多的元素。

2.nextElement()  如果此枚举对象至少还有一个可提供的元素,则返回此枚举的下一个元素。

 

使用举例:

Enumeration<String> paraNames = request.getHeaderNames();
for(Enumeration e=paraNames;e.hasMoreElements();){

  String thisName = e.nextElement().toString();
  String thisValue = request.getHeader(thisName);
  System.out.println(thisName+"--------------"+thisValue);

}

posted on 2015-10-19 13:20  曙光XK  阅读(167)  评论(0编辑  收藏  举报

导航