All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.leopard.web.session.Enumerator Maven / Gradle / Ivy

Go to download

分布式session实现。基于Leopard Memcache接口实现,目前Leopard已实现基于Memcached、Redis两种实现。

There is a newer version: 0.9.12
Show newest version
package io.leopard.web.session;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;

public class Enumerator implements Enumeration {

	public Enumerator(Collection collection) {
		this(collection.iterator());
	}

	public Enumerator(Collection collection, boolean clone) {
		this(collection.iterator(), clone);
	}

	public Enumerator(Iterator iterator) {
		super();
		this.iterator = iterator;
	}

	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();
		}
	}

	private Iterator iterator = null;

	public boolean hasMoreElements() {
		return (iterator.hasNext());
	}

	public String nextElement() throws NoSuchElementException {
		return (iterator.next());
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy