package com.laoer.session;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.NoSuchElementException;
public class Enumerator implements Enumeration {
// ----------------------------------------------------------- Constructors
/**
* Return an Enumeration over the values of the specified Collection.
*
* @param collection
* Collection whose values should be enumerated
*/
public Enumerator(Collection collection) {
this(collection.iterator());
}
/**
* Return an Enumeration over the values of the specified Collection.
*
* @param collection
* Collection whose values should be enumerated
* @param clone
* true to clone iterator
*/
public Enumerator(Collection collection, boolean clone) {
this(collection.iterator(), clone);
}
/**
* Return an Enumeration over the values returned by the specified Iterator.
*
* @param iterator
* Iterator to be wrapped
*/
public Enumerator(Iterator iterator) {
super();
this.iterator = iterator;
}
/**
* Return an Enumeration over the values returned by the specified Iterator.
*
* @param iterator
* Iterator to be wrapped
* @param clone
* true to clone iterator
*/
@SuppressWarnings("unchecked")
public Enumerator(Iterator iterator, boolean clone) {
super();
if (!clone) {
this.iterator = iterator;
} else {
List list = new ArrayList();
while (iterator.hasNext()) {
list.add(iterator.next());
}
this.iterator = list.iterator();
}
}
/**
* Return an Enumeration over the values of the specified Map.
*
* @param map
* Map whose values should be enumerated
*/
public Enumerator(Map map) {
this(map.values().iterator());
}
/**
* Return an Enumeration over the values of the specified Map.
*
* @param map
* Map whose values should be enumerated
* @param clone
* true to clone iterator
*/
public Enumerator(Map map, boolean clone) {
this(map.values().iterator(), clone);
}
// ----------------------------------------------------- Instance Variables
/**
* The <code>Iterator</code> over which the <code>Enumeration</code>
* represented by this class actually operates.
*/
private Iterator iterator = null;
// --------------------------------------------------------- Public Methods
/**
* Tests if this enumeration contains more elements.
*
* @return <code>true</code> if and only if this enumeration object
* contains at least one more element to provide, <code>false</code>
* otherwise
*/
public boolean hasMoreElements() {
return (iterator.hasNext());
}
/**
* Returns the next element of this enumeration if this enumeration has at
* least one more element to provide.
*
* @return the next element of this enumeration
*
* @exception NoSuchElementException
* if no more elements exist
*/
public Object nextElement() throws NoSuchElementException {
return (iterator.next());
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
session.rar (35个子文件)
session
WebContent
jsp1.jsp 1KB
META-INF
MANIFEST.MF 36B
WEB-INF
web.xml 929B
classes
commons-logging.properties 74B
log4j.properties 524B
com
laoer
session
HttpSessionSidWrapper.class 2KB
HttpSessionWrapper.class 2KB
MemcachedSessionFilter.class 3KB
HttpServletRequestWrapper.class 997B
SessionService.class 3KB
Enumerator.class 2KB
memcached.properties 46B
lib
java_memcached-release_1.5.jar 38KB
commons-logging-1.0.4.jar 37KB
log4j-1.2.11.jar 342KB
jsp2.jsp 850B
index.jsp 834B
.settings
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.common.project.facet.core.xml 252B
org.eclipse.wst.common.component 465B
org.eclipse.wst.jsdt.ui.superType.container 49B
.jsdtscope 493B
org.eclipse.jdt.core.prefs 395B
src
commons-logging.properties 74B
log4j.properties 524B
com
laoer
session
HttpServletRequestWrapper.java 596B
MemcachedSessionFilter.java 2KB
HttpSessionSidWrapper.java 1KB
SessionService.java 2KB
Enumerator.java 3KB
HttpSessionWrapper.java 2KB
memcached.properties 46B
.project 1KB
.mymetadata 297B
.classpath 532B
.myeclipse
共 35 条
- 1
资源评论
- beyondsu2017-11-29蛮好用的,谢谢,说得很详细
- mycrose2014-07-02厉害厉害,直接加入这个过滤器就好了,大家记得要使用这个项目里的java_memcached-release_1.5.jar。 我之前项目已经使用java_memcached-release_2.6.6.jar了,所以开始没替换,发现存在一些额问题, 用项目里的java_memcached-release_1.5.jar是OK的。
- downloadvip2016-04-23不错 收藏了
机器圣手
- 粉丝: 2
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功