Java Code Examples for java.util.Collections.emptyEnumeration()

The following are Jave code examples for showing how to use emptyEnumeration() of the java.util.Collections class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-servicecomb-java-chassis   File: CommonToHttpServletRequest.java   View Source Code Vote up 5 votes
@Override
public Enumeration<String> getHeaders(String name) {
  List<String> headerValues = httpHeaders.get(name);
  if (headerValues == null || headerValues.isEmpty()) {
    return Collections.emptyEnumeration();
  }

  return Collections.enumeration(headerValues);
}
 
Example 2
Project: incubator-netbeans   File: NbRemoteLoader.java   View Source Code Vote up 5 votes
@Override
public Enumeration<URL> findResources(String name) throws IOException {
    Enumeration<URL> origResources = getParent().getResources(name);
    Enumeration<URL> deleResources = oldDelegate != null ? oldDelegate.findResources(name) : Collections.<URL>emptyEnumeration();
    
    return new CompoundEnumeration<URL>(new Enumeration[] {
            origResources,
            deleResources,
            super.findResources(name)
    });
}
 
Example 3
Project: incubator-netbeans   File: SourceFS.java   View Source Code Vote up 5 votes
@Override
public Enumeration<String> attributes(String name) {
    Item item = getItem(name);
    if (item != null) {
        return item.getAttributes();
    } else {
        return Collections.emptyEnumeration();
    }
}
 
Example 4
Project: incubator-netbeans   File: CCTNode.java   View Source Code Vote up 5 votes
public Enumeration<CCTNode> children() {
    final CCTNode[] _children = getChildren();
    final int _childrenCount = _children == null ? 0 : _children.length;
    
    if (_childrenCount == 0) return Collections.emptyEnumeration();
    
    return new Enumeration<CCTNode>() {
        private int index = 0;
        public boolean hasMoreElements() { return index < _childrenCount; }
        public CCTNode nextElement()     { return _children[index++]; }
    };
}
 
Example 5
Project: openjdk-jdk10   File: BuiltinClassLoader.java   View Source Code Vote up 5 votes
/**
 * Returns the URLs of all resources of the given name on the class path.
 */
private Enumeration<URL> findResourcesOnClassPath(String name) {
    if (hasClassPath()) {
        if (System.getSecurityManager() == null) {
            return ucp.findResources(name, false);
        } else {
            PrivilegedAction<Enumeration<URL>> pa;
            pa = () -> ucp.findResources(name, false);
            return AccessController.doPrivileged(pa);
        }
    } else {
        // no class path
        return Collections.emptyEnumeration();
    }
}
 
Example 6
Project: pooled-jms   File: MockJMSQueueBrowser.java   View Source Code Vote up 4 votes
@Override
public Enumeration<?> getEnumeration() throws JMSException {
    checkClosed();
    return Collections.emptyEnumeration();
}
 
Example 7
Project: tasfe-framework   File: AbstractNettyRegistration.java   View Source Code Vote up 4 votes
@Override
public Enumeration<String> getInitParameterNames() {
    return Collections.emptyEnumeration();
}
 
Example 8
Project: OpenJSharp   File: SimpleAttributeSet.java   View Source Code Vote up 4 votes
public Enumeration getAttributeNames() {
    return Collections.emptyEnumeration();
}
 
Example 9
Project: jdk8u-jdk   File: SimpleAttributeSet.java   View Source Code Vote up 4 votes
public Enumeration getAttributeNames() {
    return Collections.emptyEnumeration();
}
 
Example 10
Project: openjdk-jdk10   File: SimpleAttributeSet.java   View Source Code Vote up 4 votes
public Enumeration<?> getAttributeNames() {
    return Collections.emptyEnumeration();
}
 
Example 11
Project: openjdk-jdk10   File: LoggerFinderAPI.java   View Source Code Vote up 4 votes
@Override
public Enumeration<String> getKeys() {
    return Collections.emptyEnumeration();
}
 
Example 12
Project: openjdk-jdk10   File: ClassLoader.java   View Source Code Vote up 2 votes
/**
 * Returns an enumeration of {@link java.net.URL URL} objects
 * representing all the resources with the given name. Class loader
 * implementations should override this method.
 *
 * <p> For resources in named modules then the method must implement the
 * rules for encapsulation specified in the {@code Module} {@link
 * Module#getResourceAsStream getResourceAsStream} method. Additionally,
 * it must not find non-"{@code .class}" resources in packages of named
 * modules unless the package is {@link Module#isOpen(String) opened}
 * unconditionally. </p>
 *
 * @implSpec The default implementation returns an enumeration that
 * contains no elements.
 *
 * @param  name
 *         The resource name
 *
 * @return  An enumeration of {@link java.net.URL URL} objects for
 *          the resource. If no resources could  be found, the enumeration
 *          will be empty. Resources for which a {@code URL} cannot be
 *          constructed, are in a package that is not opened unconditionally,
 *          or access to the resource is denied by the security manager,
 *          are not returned in the enumeration.
 *
 * @throws  IOException
 *          If I/O errors occur
 *
 * @since  1.2
 * @revised 9
 * @spec JPMS
 */
protected Enumeration<URL> findResources(String name) throws IOException {
    return Collections.emptyEnumeration();
}