Tabnine Logo
Collections.enumeration
Code IndexAdd Tabnine to your IDE (free)

How to use
enumeration
method
in
java.util.Collections

Best Java code snippets using java.util.Collections.enumeration (Showing top 20 results out of 9,594)

Refine searchRefine arrow

  • Map.keySet
  • Enumeration.nextElement
  • Enumeration.hasMoreElements
  • List.add
  • Map.values
origin: spring-projects/spring-framework

  @Override
  public Enumeration<String> getHeaderNames() {
    return Collections.enumeration(this.headers.keySet());
  }
}
origin: Atmosphere/atmosphere

  @Override
  public Enumeration<String> getInitParameterNames() {
    return Collections.enumeration(initParams.values());
  }
}
origin: org.osgi/org.osgi.core

/**
 * Returns an enumeration of all {@code PackagePermission} objects in the
 * container.
 * 
 * @return Enumeration of all {@code PackagePermission} objects.
 */
@Override
public synchronized Enumeration<Permission> elements() {
  List<Permission> all = new ArrayList<Permission>(permissions.values());
  Map<String, PackagePermission> pc = filterPermissions;
  if (pc != null) {
    all.addAll(pc.values());
  }
  return Collections.enumeration(all);
}
origin: stackoverflow.com

final Map <String,Integer> test = new HashMap<String,Integer>();
test.put("one",1);
test.put("two",2);
test.put("three",3);
final Enumeration<String> strEnum = Collections.enumeration(test.keySet());
while(strEnum.hasMoreElements()) {
  System.out.println(strEnum.nextElement());
}
origin: ben-manes/caffeine

/** 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));
 }
 return new SequenceInputStream(Collections.enumeration(inputs));
}
origin: org.osgi/org.osgi.compendium

public Enumeration<Object> elements() {
  Collection<Object> values = properties.values();
  List<Object> result = new ArrayList<Object>(values.size() + 1);
  result.add(topic);
  result.addAll(values);
  return Collections.enumeration(result);
}
origin: spring-projects/spring-framework

@Override
public Enumeration<String> getParameterNames() {
  if (this.multipartParameterNames == null) {
    initializeMultipart();
  }
  if (this.multipartParameterNames.isEmpty()) {
    return super.getParameterNames();
  }
  // Servlet 3.0 getParameterNames() not guaranteed to include multipart form items
  // (e.g. on WebLogic 12) -> need to merge them here to be on the safe side
  Set<String> paramNames = new LinkedHashSet<>();
  Enumeration<String> paramEnum = super.getParameterNames();
  while (paramEnum.hasMoreElements()) {
    paramNames.add(paramEnum.nextElement());
  }
  paramNames.addAll(this.multipartParameterNames);
  return Collections.enumeration(paramNames);
}
origin: Graylog2/graylog2-server

@Override
public Enumeration<URL> getResources(String name) throws IOException {
  final List<URL> urls = new ArrayList<>();
  for (ClassLoader classLoader : classLoaders) {
    final Enumeration<URL> resources = classLoader.getResources(name);
    if (resources.hasMoreElements()) {
      urls.addAll(Collections.list(resources));
    }
  }
  if (urls.isEmpty() && LOG.isTraceEnabled()) {
    LOG.trace("Resource " + name + " not found.");
  }
  return Collections.enumeration(urls);
}
origin: apache/geode

/**
 * Finds all the resources with the given name. This method will first search the class loader of
 * the context class for the resource before searching all other {@link ClassLoader}s.
 *
 * @param contextClass The class whose class loader will first be searched
 * @param name The resource name
 * @return An enumeration of {@link java.net.URL <tt>URL</tt>} objects for the resource. If no
 *         resources could be found, the enumeration will be empty. Resources that the class
 *         loader doesn't have access to will not be in the enumeration.
 * @throws IOException If I/O errors occur
 * @see ClassLoader#getResources(String)
 */
private Enumeration<URL> getResources(final Class<?> contextClass, final String name)
  throws IOException {
 final LinkedHashSet<URL> urls = new LinkedHashSet<URL>();
 if (contextClass != null) {
  CollectionUtils.addAll(urls, contextClass.getClassLoader().getResources(name));
 }
 for (ClassLoader classLoader : getClassLoaders()) {
  Enumeration<URL> resources = classLoader.getResources(name);
  if (resources != null && resources.hasMoreElements()) {
   CollectionUtils.addAll(urls, resources);
  }
 }
 return Collections.enumeration(urls);
}
origin: Atmosphere/atmosphere

@Override
public Enumeration<String> getHeaderNames() {
  Set list = new HashSet();
  list.addAll(b.headers.keySet());
  list.addAll(Collections.list(b.request.getHeaderNames()));
  if (b.request != null) {
    Enumeration e = b.request.getAttributeNames();
    while (e.hasMoreElements()) {
      String name = e.nextElement().toString();
      if (name.startsWith(X_ATMOSPHERE)) {
        list.add(name);
      }
    }
  }
  if (b.contentType != null) {
    list.add("Content-Type");
  }
  return Collections.enumeration(list);
}
origin: stackoverflow.com

 List<InputStream> opened = new ArrayList<InputStream>(files.size());
for (File f : files) 
 opened.add(new FileInputStream(f));
InputStream is = new SequenceInputStream(Collections.enumeration(opened));
origin: spring-projects/spring-framework

@Override
public Enumeration<String> getInitParameterNames() {
  return Collections.enumeration(this.initParameters.keySet());
}
origin: org.osgi/org.osgi.compendium

public Enumeration<String> keys() {
  Collection<String> keys = properties.keySet();
  List<String> result = new ArrayList<String>(keys.size() + 1);
  result.add(EVENT_TOPIC);
  result.addAll(keys);
  return Collections.enumeration(result);
}
origin: org.osgi/org.osgi.core

/**
 * Returns an enumeration of all {@code AdaptPermission} objects in the
 * container.
 * 
 * @return Enumeration of all {@code AdaptPermission} objects.
 */
@Override
public synchronized Enumeration<Permission> elements() {
  List<Permission> all = new ArrayList<Permission>(permissions.values());
  return Collections.enumeration(all);
}
origin: org.osgi/org.osgi.core

/**
 * Returns an enumeration of all the {@code ServicePermission} objects in
 * the container.
 * 
 * @return Enumeration of all the ServicePermission objects.
 */
@Override
public synchronized Enumeration<Permission> elements() {
  List<Permission> all = new ArrayList<Permission>(permissions.values());
  Map<String, ServicePermission> pc = filterPermissions;
  if (pc != null) {
    all.addAll(pc.values());
  }
  return Collections.enumeration(all);
}
origin: Atmosphere/atmosphere

  public Enumeration<String> getInitParameterNames() {
    if (!done.getAndSet(true)) {
      Enumeration en = sc.getInitParameterNames();
      if (en != null) {
        while (en.hasMoreElements()) {
          String name = (String) en.nextElement();
          if (!initParams.containsKey(name)) {
            initParams.put(name, sc.getInitParameter(name));
          }
        }
      }
    }
    return Collections.enumeration(initParams.keySet());
  }
};
origin: eclipse-vertx/vert.x

/**
 * {@inheritDoc}
 */
@Override
public Enumeration<URL> getResources(String name) throws IOException {
 // First get resources from this classloader
 List<URL> resources = Collections.list(findResources(name));
 // Then add resources from the parent
 if (getParent() != null) {
  Enumeration<URL> parentResources = getParent().getResources(name);
  if (parentResources.hasMoreElements()) {
   resources.addAll(Collections.list(parentResources));
  }
 }
 return Collections.enumeration(resources);
}
origin: org.netbeans.api/org-openide-util-lookup

private boolean ensureNext() {
  for (;;) {
    if (en != null && en.hasMoreElements()) {
      return true;
    }
    if (isEmpty()) {
      return false;
    }
    Node n2 = poll();
    if (n2.children != null) {
      addAll(n2.children);
    }
    if (n2.items != null && !n2.items.isEmpty()) {
      en = Collections.enumeration(n2.items);
    }
  }
}
origin: primefaces/primefaces

@Override
public Enumeration getParameterNames() {
  Set<String> paramNames = new LinkedHashSet<>();
  paramNames.addAll(formParams.keySet());
  Enumeration<String> original = super.getParameterNames();
  while (original.hasMoreElements()) {
    paramNames.add(original.nextElement());
  }
  return Collections.enumeration(paramNames);
}
origin: commons-io/commons-io

/**
 * 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()
 * @since 2.5
 */
public synchronized InputStream toInputStream() {
  int remaining = count;
  if (remaining == 0) {
    return new ClosedInputStream();
  }
  final List<ByteArrayInputStream> list = new ArrayList<>(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));
}
java.utilCollectionsenumeration

Javadoc

Returns an Enumeration on the specified collection.

Popular methods of Collections

  • emptyList
    Returns the empty list (immutable). This list is serializable.This example illustrates the type-safe
  • sort
  • singletonList
    Returns an immutable list containing only the specified object. The returned list is serializable.
  • unmodifiableList
    Returns an unmodifiable view of the specified list. This method allows modules to provide users with
  • emptyMap
    Returns the empty map (immutable). This map is serializable.This example illustrates the type-safe w
  • emptySet
    Returns the empty set (immutable). This set is serializable. Unlike the like-named field, this metho
  • unmodifiableMap
    Returns an unmodifiable view of the specified map. This method allows modules to provide users with
  • singleton
    Returns an immutable set containing only the specified object. The returned set is serializable.
  • unmodifiableSet
    Returns an unmodifiable view of the specified set. This method allows modules to provide users with
  • singletonMap
    Returns an immutable map, mapping only the specified key to the specified value. The returned map is
  • addAll
    Adds all of the specified elements to the specified collection. Elements to be added may be specifie
  • reverse
    Reverses the order of the elements in the specified list. This method runs in linear time.
  • addAll,
  • reverse,
  • unmodifiableCollection,
  • shuffle,
  • list,
  • synchronizedMap,
  • synchronizedList,
  • reverseOrder,
  • emptyIterator

Popular in Java

  • Parsing JSON documents to java classes using gson
  • onCreateOptionsMenu (Activity)
  • runOnUiThread (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Runner (org.openjdk.jmh.runner)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now