Java Code Examples for java.util.SortedSet.forEach()

The following are Jave code examples for showing how to use forEach() of the java.util.SortedSet class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: buenojo   File:   Source Code and License Vote up 5 votes
public void destroy() {"Remove Cache Manager metrics");
    SortedSet<String> names = metricRegistry.getNames();
    names.forEach(metricRegistry::remove);"Closing Cache Manager");
Example 2
Project: app-ms   File:   Source Code and License Vote up 5 votes
 * Register the routes.
 * @param applicationClass
 *            application class to get the root
 * @param router
 *            router to apply the changes to
 * @param pathsProvider
 *            provides a list of Path classes
 * @param jaxRsHandler
 *            route handler
public void register(final Class<? extends Application> applicationClass,
    final Router router,
    final PathsProvider pathsProvider,
    final Handler<RoutingContext> jaxRsHandler) {

    final String rootPath = Optional.ofNullable(applicationClass.getAnnotation(ApplicationPath.class)).map(ApplicationPath::value).orElse("");

    final SortedSet<JaxRsPath> paths = new TreeSet<>();
    pathsProvider.getPathAnnotatedClasses().forEach(clazz -> {
        final String classPath = Optional.ofNullable(clazz.getAnnotation(Path.class)).map(Path::value).orElse("");
        stream(clazz.getMethods()).filter(m -> m.getAnnotation(GET.class) != null
            || m.getAnnotation(POST.class) != null
            || m.getAnnotation(PUT.class) != null
            || m.getAnnotation(DELETE.class) != null).forEach(m -> {
                final String path = Optional.ofNullable(m.getAnnotation(Path.class)).map(Path::value).orElse("");
                final String[] consumes = Optional.ofNullable(m.getAnnotation(Consumes.class)).map(Consumes::value).orElse(new String[0]);
                final String[] produces = Optional.ofNullable(m.getAnnotation(Produces.class)).map(Produces::value).orElse(new String[0]);

                paths.add(new JaxRsPath(UriBuilder.fromPath(rootPath).path(classPath).path(path).toTemplate(), consumes, produces, getHttpMethod(m)));

    paths.forEach(p -> {
        p.apply(router, jaxRsHandler, failureHandler);
        LOG.debug("route={}", p);