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.github.benmanes.caffeine.cache.simulator.parser.AbstractTraceReader.java

/** Returns the input stream of the trace data. */
protected InputStream readFiles() throws IOException {
    List<InputStream> inputs = new ArrayList<>(filePaths.size());
    for (String filePath : filePaths) {
        inputs.add(readFile(filePath));//from  w  w  w  .  ja  v  a 2  s.  c  o m
    }
    return new SequenceInputStream(Collections.enumeration(inputs));
}

From source file:com.manydesigns.portofino.i18n.ConfigurationResourceBundle.java

public Enumeration<String> getKeys() {
    Set<String> myKeys = handleKeySet();
    if (parent != null) {
        Enumeration<String> parentKeysEnum = parent.getKeys();
        while (parentKeysEnum.hasMoreElements()) {
            myKeys.add(parentKeysEnum.nextElement());
        }/*from w  w w.ja  va  2  s  . c o m*/
    }
    return Collections.enumeration(myKeys);
}

From source file:com.itpro.restws.helper.MultipartFromWrapper.java

/**
 * Return all request parameter names, for both regular controls and file
 * upload controls./*w  w w  . java 2s. c o  m*/
 */
@Override
public Enumeration<String> getParameterNames() {
    Set<String> allNames = new LinkedHashSet<>();
    allNames.addAll(fRegularParams.keySet());
    allNames.addAll(fFileParams.keySet());
    return Collections.enumeration(allNames);
}

From source file:com.publicuhc.pluginframework.translate.YamlResourceBundle.java

@Override
public Enumeration<String> getKeys() {
    //get all of the keys we know about
    Set<String> configKeys = configuration.getKeys(true);

    //if we have a parent file add all of their keys too
    if (parent != null) {
        Iterators.addAll(configKeys, Iterators.forEnumeration(parent.getKeys()));
    }// w  ww  .j  av a 2  s  .  c om

    //return the list of keys
    return Collections.enumeration(configKeys);
}

From source file:org.musicrecital.webapp.filter.LocaleRequestWrapper.java

/**
 * {@inheritDoc}//from www. j a  v a  2 s.c om
 */
@SuppressWarnings("unchecked")
public Enumeration<Locale> getLocales() {
    if (null != preferredLocale) {
        List<Locale> l = Collections.list(super.getLocales());
        if (l.contains(preferredLocale)) {
            l.remove(preferredLocale);
        }
        l.add(0, preferredLocale);
        return Collections.enumeration(l);
    } else {
        return super.getLocales();
    }
}

From source file:com.liferay.portal.template.velocity.internal.FastExtendedProperties.java

@Override
@SuppressWarnings("rawtypes")
public Enumeration elements() {
    return Collections.enumeration(_map.values());
}

From source file:nz.co.fortytwo.freeboard.server.util.Util.java

/**
 * Load the config from the named dir, or if the named dir is null, from the
 * default location The config is cached, subsequent calls get the same
 * object//from  ww  w .  j  av a  2s .  co  m
 *
 * @param dir
 * @return
 * @throws FileNotFoundException
 * @throws IOException
 */
public static Properties getConfig(String dir) throws FileNotFoundException, IOException {
    if (props == null) {
        //we do a quick override so we get nice sorted output :-)
        System.out.println("Creating config...");
        props = new Properties() {
            /**
             *
             */
            private static final long serialVersionUID = 1L;

            @Override
            public Set<Object> keySet() {
                return Collections.unmodifiableSet(new TreeSet<Object>(super.keySet()));
            }

            @Override
            public synchronized Enumeration<Object> keys() {
                return Collections.enumeration(new TreeSet<Object>(super.keySet()));
            }
        };
        Util.setDefaults(props);
        if (StringUtils.isNotBlank(dir)) {
            //we provided a config dir, so we use it
            props.setProperty(Constants.CFG_DIR, dir);
            cfg = new File(props.getProperty(Constants.CFG_DIR) + props.getProperty(Constants.CFG_FILE));
        } else if (Util.getUSBFile() != null) {
            //nothing provided, but we have a usb config dir, so use it
            cfg = new File(Util.getUSBFile(),
                    props.getProperty(Constants.CFG_DIR) + props.getProperty(Constants.CFG_FILE));
        } else {
            //use the default config
            cfg = new File(props.getProperty(Constants.CFG_DIR) + props.getProperty(Constants.CFG_FILE));
        }

        if (cfg.exists()) {
            System.out.println("Loading config from " + cfg.getAbsolutePath());
            props.load(new FileReader(cfg));
        } else {
            saveConfig();
        }
    }
    return props;
}

From source file:org.apache.hadoop.gateway.filter.IdentityAssertionHttpServletRequestWrapper.java

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override/*  w  ww  . j a  v  a2 s  .c  o  m*/
public Enumeration getParameterNames() {
    Map<String, String[]> params = getParams();
    Enumeration<String> e = Collections.enumeration((Collection<String>) params);

    return e;
}

From source file:XMLResourceBundleControl.java

public Enumeration<String> getKeys() {
    Set<String> handleKeys = props.stringPropertyNames();
    return Collections.enumeration(handleKeys);
}

From source file:hirondelle.situris.main.centrosInteresse.FileUploadWrapper.java

/**
 Return all request parameter names, for both regular controls and file upload 
 controls./* w  ww.  j a va2 s. c  o  m*/
         
 <P>Returning the name of file upload controls allows checking of the returned
 param names versus a 'white list' of expected names. This increases security, 
 which is especially important for file upload forms.
 See {@link hirondelle.web4j.security.ApplicationFirewallImpl} as well.
         
 <P>Does not include query params passed to 
 <tt>request.getRequestDispatcher(String)</tt>.
*/
@Override
public Enumeration getParameterNames() {
    Set<String> allNames = new LinkedHashSet<String>();
    allNames.addAll(fRegularParams.keySet());
    allNames.addAll(fFileParams.keySet());
    return Collections.enumeration(allNames);
}