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:com.xpn.xwiki.web.XWikiServletRequestStub.java

@Override
public Enumeration<String> getParameterNames() {
    return this.parameters != null ? Collections.enumeration(this.parameters.keySet()) : null;
}

From source file:org.mifos.core.PseudoLocalizationGenerator.java

/**
 * To be compatible with version control systems, we need to sort properties
 * before storing them to disk. Otherwise each change may lead to problems
 * by diff against previous version - because Property entries are randomly
 * distributed (it's a map)./*  w  w w .  j  a va  2  s .  c o m*/
 * 
 * @param keySet
 *            non null set instance to sort
 * @return non null list which contains all given keys, sorted
 *         lexicographically. The list may be empty if given set was empty
 */
@Override
@SuppressWarnings("unchecked")
public Enumeration keys() {
    ArrayList list = new ArrayList(keySet());
    Collections.sort(list);
    return Collections.enumeration(list);
}

From source file:edu.cornell.mannlib.vitro.webapp.controller.MultipartRequestWrapper.java

/**
 * Look in the map of parsed parameters. Make a protective copy.
 *///ww w  .j a va  2s . c  o  m
@Override
public Enumeration<?> getParameterNames() {
    return Collections.enumeration(new HashSet<>(parameters.keySet()));
}

From source file:io.wcm.caravan.io.http.impl.servletclient.HttpServletRequestMapper.java

@Override
public Enumeration<String> getHeaderNames() {
    return Collections.enumeration(request.getHeaders().keySet());
}

From source file:org.apache.beehive.netui.pageflow.scoping.internal.ScopedRequestImpl.java

public Enumeration getParameterNames() {
    ArrayList paramNames = new ArrayList();

    for (Enumeration e = getRequest().getParameterNames(); e.hasMoreElements();) {
        String scopedParamName = (String) e.nextElement();

        if (_scopedContainer.isInScope(scopedParamName)) {
            paramNames.add(_scopedContainer.removeScope(scopedParamName));
        } else if (_isActiveRequest && scopedParamName.startsWith(AUTOSCOPE_PREFIX)) {
            paramNames.add(scopedParamName);
        } else if (_listenScopes != null) {
            for (int i = 0, len = _listenScopes.size(); i < len; ++i) {
                Object scope = _listenScopes.get(i);

                if (ScopedAttributeContainer.isInScope(scopedParamName, scope)) {
                    paramNames.add(ScopedAttributeContainer.removeScope(scopedParamName, scope));
                }//  ww  w  . j  av a2 s .  c  o  m
            }
        }
    }

    return Collections.enumeration(paramNames);
}

From source file:com.twinsoft.convertigo.eclipse.popup.actions.DatabaseObjectDeleteAction.java

public void run() {
    Display display = Display.getDefault();
    Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);

    Shell shell = getParentShell();//  www  .  ja v a2  s  . c om
    shell.setCursor(waitCursor);

    try {
        treeNodesToUpdate = new ArrayList<DatabaseObjectTreeObject>();

        ProjectExplorerView explorerView = getProjectExplorerView();
        if (explorerView != null) {
            TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
            if (treeObjects != null) {
                DatabaseObjectTreeObject treeObject = null;
                String message = "";
                MultipleDeletionDialog dialog;

                if (treeObjects.length == 1) {
                    dialog = new MultipleDeletionDialog(shell, "Object Deletion", false);
                } else {
                    dialog = new MultipleDeletionDialog(shell, "Object Deletion", true);
                }

                int len;

                len = treeObjects.length;
                for (int i = 0; i < len; i++) {
                    treeObject = (DatabaseObjectTreeObject) treeObjects[i];

                    if (treeObject instanceof ProjectTreeObject) {
                        message = java.text.MessageFormat.format(
                                "Do you really want to delete the project \"{0}\" and all its sub-objects?",
                                new Object[] { treeObject.getName() });
                    } else {
                        message = java.text.MessageFormat.format(
                                "Do you really want to delete the object \"{0}\" and all its sub-objects?",
                                new Object[] { treeObject.getName() });
                    }

                    if (!dialog.shouldBeDeleted(message))
                        continue;

                    if (treeObject instanceof ProjectTreeObject) {
                        ((ProjectTreeObject) treeObject).closeAllEditors();
                    } else if (treeObject instanceof SequenceTreeObject) {
                        ((ProjectTreeObject) ((SequenceTreeObject) treeObject).getParent().getParent())
                                .closeSequenceEditors((Sequence) treeObject.getObject());
                    } else if (treeObject instanceof ConnectorTreeObject) {
                        ((ProjectTreeObject) ((ConnectorTreeObject) treeObject).getParent().getParent())
                                .closeConnectorEditors((Connector) treeObject.getObject());
                    } else if (treeObject instanceof StepTreeObject) {
                        // We close the editor linked with the SimpleStep (=SequenceJsStep)
                        if (treeObject.getObject() instanceof SimpleStep) {
                            boolean find = false;
                            SimpleStep simpleStep = (SimpleStep) treeObject.getObject();
                            IWorkbenchPage page = this.getActivePage();
                            IEditorReference[] editors = page.getEditorReferences();
                            int _i = 0;
                            while (find != true && _i < editors.length) {
                                IEditorReference editor = editors[_i];
                                IEditorPart editorPart = page.findEditor(editor.getEditorInput());
                                if (editorPart != null && editorPart instanceof JscriptStepEditor) {
                                    JscriptStepEditor jscriptEditor = (JscriptStepEditor) editorPart;
                                    if (jscriptEditor.getSimpleStepLinked().equals(simpleStep)) {
                                        find = true;
                                        page.activate(editorPart);
                                        page.closeEditor(editorPart, false);
                                    }
                                }
                                ++_i;
                            }
                        }
                    }

                    delete(treeObject);

                    if (treeObject instanceof ProjectTreeObject) {
                        explorerView.removeProjectTreeObject(treeObject);
                    } else {
                        // prevents treeObject and its childs to receive further TreeObjectEvents
                        if (treeObject instanceof TreeObjectListener)
                            explorerView.removeTreeObjectListener(treeObject);
                        treeObject.removeAllChildren();
                    }

                    explorerView.fireTreeObjectRemoved(new TreeObjectEvent(treeObject));
                }

                // Updating the tree and the properties panel
                Enumeration<DatabaseObjectTreeObject> enumeration = Collections.enumeration(treeNodesToUpdate);
                DatabaseObjectTreeObject parentTreeObject;
                while (enumeration.hasMoreElements()) {
                    parentTreeObject = enumeration.nextElement();
                    if (parentTreeObject != null) {
                        explorerView.reloadTreeObject(parentTreeObject);
                        explorerView.setSelectedTreeObject(parentTreeObject);
                    }
                }

                // Refresh tree to show potential 'broken' steps
                explorerView.refreshTree();
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to delete object!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}

From source file:jp.terasoluna.fw.util.PropertyUtil.java

/**
 * ????????//from  www. j av a 2  s  .  c  o  m
 * @return ??????
 */
public static Enumeration<String> getPropertyNames() {
    return Collections.enumeration(props.keySet());
}

From source file:org.opennms.netmgt.config.datacollection.SnmpCollection.java

/**
 * Method enumerateIncludeCollection.// w  w  w .j  a  va 2  s .com
 * 
 * @return an Enumeration over all possible elements of this
 * collection
 */
public Enumeration<IncludeCollection> enumerateIncludeCollection() {
    return Collections.enumeration(m_includeCollections);
}

From source file:de.micromata.genome.test.web.SimServletContext.java

@Override
@SuppressWarnings({ "rawtypes" })
public Enumeration getServletNames() {
    return Collections.enumeration(Collections.emptySet());
}

From source file:de.micromata.genome.tpsb.httpmockup.MockServletContext.java

/** Deprecated method always returns an empty enumeration. */
@Override//  w  w  w .j  a  v a  2  s. c  o m
public Enumeration getServlets() {
    return Collections.enumeration(Collections.emptySet());
}