Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 45009 invoked from network); 7 Sep 2008 19:25:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Sep 2008 19:25:08 -0000 Received: (qmail 47722 invoked by uid 500); 7 Sep 2008 19:25:03 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 47684 invoked by uid 500); 7 Sep 2008 19:25:03 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 47597 invoked by uid 99); 7 Sep 2008 19:25:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Sep 2008 12:25:03 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Sep 2008 19:24:13 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 66B7B234C1C7 for ; Sun, 7 Sep 2008 12:24:44 -0700 (PDT) Message-ID: <1974166773.1220815484419.JavaMail.jira@brutus> Date: Sun, 7 Sep 2008 12:24:44 -0700 (PDT) From: "Michael McCandless (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Resolved: (LUCENE-1369) Eliminate unnecessary uses of Hashtable and Vector In-Reply-To: <1449392577.1219951544272.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LUCENE-1369?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Michael McCandless resolved LUCENE-1369. ---------------------------------------- Resolution: Fixed Lucene Fields: [New, Patch Available] (was: [Patch Available, New]) Thanks DM! > Eliminate unnecessary uses of Hashtable and Vector > -------------------------------------------------- > > Key: LUCENE-1369 > URL: https://issues.apache.org/jira/browse/LUCENE-1369 > 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 wrapper. > # 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 iteration. -- 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: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org