Example usage for java.util Collections enumeration

List of usage examples for java.util Collections enumeration

Introduction

In this page you can find the example usage for java.util Collections enumeration.

Prototype

public static <T> Enumeration<T> enumeration(final Collection<T> c) 

Source Link

Document

Returns an enumeration over the specified collection.

Usage

From source file:org.opennms.netmgt.xml.eventconf.Event.java

/**
 * Method enumerateLoggroup./*  ww w .j  av  a2s.c o  m*/
 * 
 * @return an Enumeration over all possible elements of this
 * collection
 */
public Enumeration<String> enumerateLoggroup() {
    return Collections.enumeration(this.m_loggroupList);
}

From source file:org.silverpeas.servlet.HttpRequest.java

/**
 * Returns an Enumeration of String objects containing the names of the parameters contained in
 * this request. If the request has no parameters, the method returns an empty Enumeration. The
 * parameters from a multipart/form-data stream are also considered by this method, unlike of the
 * default behavior of the decorated request.
 *
 * @return an Enumeration of String objects, each String containing the name of a request
 * parameter; or an empty Enumeration if the request has no parameters.
 *///from  w  w w.j a  v a  2  s. com
@Override
public Enumeration<String> getParameterNames() {
    Enumeration<String> names = super.getParameterNames();
    if (!names.hasMoreElements() && isContentInMultipart()) {
        List<FileItem> items = getFileItems();
        List<String> itemNames = new ArrayList<String>(items.size());
        for (FileItem item : items) {
            if (item.isFormField()) {
                itemNames.add(item.getFieldName());
            }
        }
        names = Collections.enumeration(itemNames);
    }
    return names;
}

From source file:org.openmrs.util.OpenmrsClassLoader.java

/**
 * Searches all known module classloaders first, then parent classloaders
 *
 * @see java.lang.ClassLoader#getResources(java.lang.String)
 *//* ww  w  . j  ava2 s  . c o m*/
@Override
public Enumeration<URL> getResources(String packageName) throws IOException {
    Set<URI> results = new HashSet<URI>();
    for (ModuleClassLoader classLoader : ModuleFactory.getModuleClassLoaders()) {
        Enumeration<URL> urls = classLoader.getResources(packageName);
        while (urls.hasMoreElements()) {
            URL result = urls.nextElement();
            if (result != null) {
                try {
                    results.add(result.toURI());
                } catch (URISyntaxException e) {
                    throwInvalidURI(result, e);
                }
            }
        }
    }

    for (Enumeration<URL> en = super.getResources(packageName); en.hasMoreElements();) {
        URL url = en.nextElement();
        try {
            results.add(url.toURI());
        } catch (URISyntaxException e) {
            throwInvalidURI(url, e);
        }
    }

    List<URL> resources = new ArrayList<URL>(results.size());
    for (URI result : results) {
        resources.add(result.toURL());
    }

    return Collections.enumeration(resources);
}

From source file:org.codehaus.plexus.archiver.zip.ByteArrayOutputStream.java

/**
 * Gets the current contents of this byte stream as a Input Stream. The
 * returned stream is backed by buffers of <code>this</code> stream,
 * avoiding memory allocation and copy, thus saving space and time.<br>
 *
 * @return the current contents of this output stream.
 * @see java.io.ByteArrayOutputStream#toByteArray()
 * @see #reset()/*from  ww  w. j a v a  2  s  .  c  o m*/
 * @since 2.5
 */
public synchronized InputStream toInputStream() {
    int remaining = count;
    if (remaining == 0) {
        return new ClosedInputStream();
    }
    final List<ByteArrayInputStream> list = new ArrayList<ByteArrayInputStream>(buffers.size());
    for (final byte[] buf : buffers) {
        final int c = Math.min(buf.length, remaining);
        list.add(new ByteArrayInputStream(buf, 0, c));
        remaining -= c;
        if (remaining == 0) {
            break;
        }
    }
    reuseBuffers = false;
    return new SequenceInputStream(Collections.enumeration(list));
}

From source file:org.opennms.netmgt.xml.eventconf.Event.java

/**
 * Method enumerateOperaction.//from  w ww  .  j  a  v  a 2s  .  c  om
 * 
 * @return an Enumeration over all possible elements of this
 * collection
 */
public Enumeration<Operaction> enumerateOperaction() {
    return Collections.enumeration(this.m_operactionList);
}

From source file:org.jruby.rack.mock.MockServletContext.java

public Enumeration<String> getAttributeNames() {
    return Collections.enumeration(this.attributes.keySet());
}

From source file:com.silverwrist.dynamo.db.GroupObject.java

public Enumeration members() {
    try { // call down, get the UIDs, and use them to get proxies
        int[] uids = this.getUIDs();
        ArrayList tmp = new ArrayList(uids.length);
        for (int i = 0; i < uids.length; i++)
            tmp.add(m_upm.getUserProxy(uids[i]));
        return Collections.enumeration(tmp);

    } // end try//from w w w. j  a v a 2  s. c o  m
    catch (DatabaseException e) { // wrap this exception and return it
        throw new GroupRuntimeException(e);

    } // end catch

}

From source file:org.opennms.netmgt.xml.eventconf.Event.java

/**
 * Method enumerateScript./*from  w  ww  .  j a va 2  s .co m*/
 * 
 * @return an Enumeration over all possible elements of this
 * collection
 */
public Enumeration<Script> enumerateScript() {
    return Collections.enumeration(this.m_scriptList);
}

From source file:org.directwebremoting.util.FakeHttpServletRequest.java

public Enumeration<String> getParameterNames() {
    return Collections.enumeration(Collections.<String>emptySet());
}

From source file:org.opennms.netmgt.xml.eventconf.Event.java

/**
 * Method enumerateVarbindsdecode.//from   w  w  w  .j a  va2s . com
 * 
 * @return an Enumeration over all possible elements of this
 * collection
 */
public Enumeration<Varbindsdecode> enumerateVarbindsdecode() {
    return Collections.enumeration(this.m_varbindsdecodeList);
}