dev@grizzly.java.net

Re: [grizzly~svn:5418] + Optimize memory management (together with Ryan)

From: Matthew Swift <matthew.swift_at_oracle.com>
Date: Mon, 29 Nov 2010 22:42:59 +0100

> [...]
> + In HTTP, HTTP-SERVER modules use Iterators instead of Enumerators
>

Would it be possible to return Collections or, at the very least,
Iterables instead of Iterators? It's a bit of a pain when an API returns
Iterator because client code is unnecessarily complex. For example:

         final Iterator<String> names = request.getHeaderNames();
         while (names.hasNext())
         {
           final String name = names.next();
           final String value = request.getHeader(name);
           ...
         }

Instead of:

         for (String name : request.getHeaderNames())
         {
           final String value = request.getHeader(name);
           ...
         }

Matt