Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 4713 invoked from network); 20 Aug 2008 12:19:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Aug 2008 12:19:20 -0000 Received: (qmail 53389 invoked by uid 500); 20 Aug 2008 12:19:13 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 53350 invoked by uid 500); 20 Aug 2008 12:19:12 -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 53340 invoked by uid 99); 20 Aug 2008 12:19:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Aug 2008 05:19:12 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of dmsmith555@gmail.com designates 209.85.217.13 as permitted sender) Received: from [209.85.217.13] (HELO mail-gx0-f13.google.com) (209.85.217.13) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Aug 2008 12:18:15 +0000 Received: by gxk6 with SMTP id 6so69325gxk.5 for ; Wed, 20 Aug 2008 05:18:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :content-type:content-transfer-encoding:mime-version:subject:date :x-mailer; bh=aJ3oKu1lTc7CzL/+Esv99OXSZaqdqi3yw95F9N225OM=; b=enHCvS5F0MOEwZIvIcsyIbhDbgk/dIKcNkcO9BGaHlMHB1OCV0IGfsUFrLLXEJH7J/ fySAze1BJ/G3vnSQrmUTOX1BrPSQkYj+HNTVH2qewKeS8+WHFw2DjUYO4FnO6wULMWuc LtxxnuJmLQrucJy/qEyZz2R5Fr1neginXvHh0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:content-type:content-transfer-encoding :mime-version:subject:date:x-mailer; b=bj+lFnpfzj5WgzYsWjv1dv5VaFyNecBUVkGnHhkUMyFDid+v6Mw3HCTuHoInL/Fu0r R+DKxxNXQdosNXVzWpucdxG+fhlZXq7waij9NWj9os54h1jCaWgbvtvBd9Gk75izTRRS qjMUHweOBTeonppmZ76v1TtA5YRAHylFFSWNE= Received: by 10.150.229.16 with SMTP id b16mr198247ybh.133.1219234723383; Wed, 20 Aug 2008 05:18:43 -0700 (PDT) Received: from ?10.0.1.199? ( [24.210.174.243]) by mx.google.com with ESMTPS id s31sm2269464qbs.11.2008.08.20.05.18.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 20 Aug 2008 05:18:42 -0700 (PDT) Message-Id: From: DM Smith To: java-dev@lucene.apache.org Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v926) Subject: Vector and Hashtable usage Date: Wed, 20 Aug 2008 08:18:40 -0400 X-Mailer: Apple Mail (2.926) X-Virus-Checked: Checked by ClamAV on apache.org I noticed that Vector and Hashtable are fairly widely used in Lucene both within classes and in their API. Looking at it, it appears that synchronization is inconsistent and that the classes were used more as a collection rather than for its sync. For example, I frequently see something like the following: for (int i = 0; i < v.size(); i++) { Object o = v.getElementAt(i); } Since Java 1.2, Vector implements List and Hashtable implements Map. When a synchronized List or Map is needed, it can be wrapped with Collections.synchronizeList(...) and Collections.synchronizedMap(...). Am I missing something? Is there a reason for using Vector and Hashtable? Replacing the internal usage is trivial. It's usage in the API is not very hard to replace, but it may break backward compatibility. IIRC that all the methods that return Vector or Hashtable are all package protected. I presume that this means that the method is private to Lucene (though we all know how to cheat this:) and that these can be change easily. When they are used as a parameter, they can be safely replaced with List and Map. If the method or class is final, then there would be no break in backward compatibility. If not final, then it breaks derivation but not usage. I was surprised to see that Query uses it for the list of clauses and also as a super for a class. Since we are talking about going to 2.4 and the plan is to get to 3.0 shortly after that, this is the time to deprecate it's usage in a the API. -- DM Smith --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org