Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: where's your Vector, victor Date: Fri, 30 May 2014 19:28:59 +0200 Lines: 20 Message-ID: References: <19baa0fb-e0fb-4565-b1eb-44018eb3045d@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: individual.net Z8MSGS2U+wzk6C8BfHFM5A452qp1QhY5RkgJu+yWTRpvBtoXM= Cancel-Lock: sha1:iYmBWZMFXWreMgVFAlfP0TQPB38= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 In-Reply-To: Xref: csiph.com comp.lang.java.programmer:28621 On 30.05.2014 12:45, Josip Almasi wrote: > On 05/30/2014 10:11 AM, bob smith wrote: >> I read that the Vector class is obsolete. >> >> Can someone tell me in a nutshell why this is so? > > Same as with Hashtable. > It's all synchronized, =3D slow. > And to make things worse, returned iterators are not synchronized:) This is not true. java.util.Vector.Itr does go through the same=20 mutex as the Vector it is iterating. But, as J=F6rg and others have=20 noted, synchronizing all methods is not sufficient to ensure thread=20 safety - especially not if multiple method calls must be executed=20 atomically. Then you still need an explicit synchronized block. Cheers robert