lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <>
Subject [jira] Commented: (LUCENE-1369) Eliminate unnecessary uses of Hashtable and Vector
Date Mon, 01 Dec 2008 10:53:44 GMT


Michael McCandless commented on LUCENE-1369:

Ugh, that was definitely a break in back-compat -- my bad.

I missed that this change would mean we silently stop calling the Vector-based methods in

I'll send an email to java-user.

> Eliminate unnecessary uses of Hashtable and Vector
> --------------------------------------------------
>                 Key: LUCENE-1369
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>    Affects Versions: 2.3.2
>            Reporter: DM Smith
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 2.4
>         Attachments: LUCENE-1369.patch
> Lucene uses Vector, Hashtable and Enumeration when it doesn't need to. Changing to ArrayList
and HashMap may provide better performance.
> There are a few places Vector shows up in the API. IMHO, List should have been used for
parameters and return values.
> There are a few distinct usages of these classes:
> # internal but with ArrayList or HashMap would do as well. These can simply be replaced.
> # internal and synchronization is required. Either leave as is or use a collections synchronization
> # As a parameter to a method where List or Map would do as well. For contrib, just replace.
For core, deprecate current and add new method signature.
> # Generated by JavaCC. (All *.jj files.) Nothing to be done here.
> # As a base class. Not sure what to do here. (Only applies to SegmentInfos extends Vector,
but it is not used in a safe manner in all places. Perhaps, implements List would be better.)
> # As a return value from a package protected method, but synchronization is not used.
Change return type.
> # As a return value to a final method. Change to List or Map.
> In using a Vector the following iteration pattern is frequently used.
> for (int i = 0; i < v.size(); i++) {
>   Object o = v.elementAt(i);
> }
> This is an indication that synchronization is unimportant. The list could change during

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message