org.infinispan.commons.util.EnumerationList Maven / Gradle / Ivy
package org.infinispan.commons.util;
import java.util.Enumeration;
import java.util.LinkedList;
import java.util.List;
/**
* An Enumeration → List adaptor
*
* @author Pete Muir
*/
public class EnumerationList extends ForwardingList
{
// The enumeration as a list
private final List list = new LinkedList();
/**
* Constructor
*
* @param enumeration The enumeration
*/
public EnumerationList(Enumeration enumeration)
{
while (enumeration.hasMoreElements())
{
list.add(enumeration.nextElement());
}
}
@Override
protected List delegate()
{
return list;
}
}