dev@javaserverfaces.java.net

Re: [REVIEW] Cleanup/Minor refactoring of Generators in jsf-tools

From: Adam Winer <adam.winer_at_oracle.com>
Date: Mon, 13 Dec 2004 10:01:50 -0800

Ed Burns wrote:

> RL> + protected static final Set JAVA_KEYWORDS = new HashSet(57);
>
> I don't see the real value in hard coding the size. If someone were to
> add or remove an entry in the future, this may cause an IOOBE. In the
> name of futureproofing, please return to having no size. Since this is
> a generator, performance isn't as key.
>
> ...
>
> RL> + protected static Map UNWRAPPERS = new HashMap(8);
>
> Same thing here.
>
> RL> + protected static Map WRAPPERS = new HashMap(8);
>
> and here.

FWIW, there is no risk of IOOBE here. Passing a size to
the constructor of HashMaps and HashSets simply pre-allocates
a set size; it does not put a maximum size on those objects.
It's purely an optimization, and a minor one at that.

For example, the following two entries are precisely equivalent
in behavior (as of JDK 1.4)
   new HashMap()
   new HashMap(16)

-- Adam

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net