Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #28619

Re: where's your Vector, victor

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: where's your Vector, victor
Date Fri, 30 May 2014 11:31:34 -0400
Organization A noiseless patient Spider
Lines 41
Message-ID <lma88r$4hn$1@dont-email.me> (permalink)
References <19baa0fb-e0fb-4565-b1eb-44018eb3045d@googlegroups.com> <lma4pp$a4s$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Fri, 30 May 2014 15:31:39 +0000 (UTC)
Injection-Info mx05.eternal-september.org; posting-host="bd4e1cba8d8592bec5d5ed9e4537fbfd"; logging-data="4663"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18N/fBpmz1CxpJqArMid5uB"
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
In-Reply-To <lma4pp$a4s$1@dont-email.me>
Cancel-Lock sha1:G7E1duZ1jfhnIJn3esby7P09Gjo=
Xref csiph.com comp.lang.java.programmer:28619

Show key headers only | View raw


On 5/30/2014 10:32 AM, Knute Johnson wrote:
> On 5/30/2014 01:11, bob smith wrote:
>> I read that the Vector class is obsolete.
>>
>> Can someone tell me in a nutshell why this is so?
>>
>> Thank you.
>>
>
> Mostly mythology.  The Vector provides some additional functionality
> over a synchronized List but it's probably not something you will need.

     I'm "mostly" in agreement.  For curiosity's sake, though, I ran
a few simple timing tests and found that Vector took about 35% more
time than ArrayList (for the mix of operations I tried).

     "That's HU-U-U-GE!" somebody's shouting, but does it truly  make a
difference?  What else is the program doing, and how much time does it
spend on things other than List manipulation?  Like, say, constructing
the things that go into the Lists, ruminating about which Lists they
belong in, converting them to and from XML, ...?

     FWIW, the same tests also found that the List formed by applying
Collections.synchronizedList() to an ArrayList was about 5% slower
than Vector ...

>   If you don't need any synchronization then use an ArrayList, if you do
> the Vector will work fine too.
>
> I use Vector every time I can just to send the big giant heads into a
> tizzy.

     :)

     Also, there are a few API's in the core Java suite that still deal
in Vectors, particularly in Swing: DefaultComboBoxModel, JList, JTree, 
DefaultTableModel, ...

-- 
Eric Sosman
esosman@comcast-dot-net.invalid

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

where's your Vector, victor bob smith <bob@coolfone.net63.net> - 2014-05-30 01:11 -0700
  Re: where's your Vector, victor Josip Almasi <joe@vrspace.org> - 2014-05-30 12:45 +0200
    Re: where's your Vector, victor Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-05-30 08:06 -0400
    Re: where's your Vector, victor Robert Klemme <shortcutter@googlemail.com> - 2014-05-30 19:28 +0200
  Re: where's your Vector, victor Joerg Meier <joergmmeier@arcor.de> - 2014-05-30 12:58 +0200
  Re: where's your Vector, victor Knute Johnson <eternal@knutejohnson.com> - 2014-05-30 07:32 -0700
    Re: where's your Vector, victor Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-05-30 11:31 -0400
      Re: where's your Vector, victor Robert Klemme <shortcutter@googlemail.com> - 2014-05-30 19:30 +0200
      Re: where's your Vector, victor Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2014-05-31 00:30 +0300
        Re: where's your Vector, victor Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-05-30 18:23 -0400
          Re: where's your Vector, victor Robert Klemme <shortcutter@googlemail.com> - 2014-05-31 12:17 +0200
      Re: where's your Vector, victor leif.roar@invalid.com (Leif Roar Moldskred) - 2014-06-01 07:37 -0500
  Re: where's your Vector, victor Roedy Green <see_website@mindprod.com.invalid> - 2014-06-06 01:00 -0700

csiph-web