Abandon JAVA.util.Hashtable and JAVA.util.Vector
6 Message(s) by 4 Author(s) originally posted in java advocacy
| From: Lew |
Date: Saturday, March 31, 2007
|
Abandon JAVA.util.Hashtable and JAVA.util.Vector. Use other JAVA.util.Map and
JAVA.util.List implementations instead, such as JAVA.util.HashMap and
JAVA.util.ArrayList, respectively.
While you're at it, do not use JAVA.util.Enumeration; stick with
JAVA.util.Iterator.
-- Lew
| From: a24900 |
Date: Sunday, April 01, 2007
|
wrote in message:
Abandon JAVA.util.Hashtable and JAVA.util.Vector. Use other JAVA.util.Map and
JAVA.util.List implementations instead, such as JAVA.util.HashMap and
JAVA.util.ArrayList, respectively.
Tell that the m*th*f*ck*s at
Sun who still have not updated many
standard APIs to use the "new" collection interfaces and classes.
| From: The Ghost In The Machine |
Date: Monday, April 02, 2007
|
In comp.lang.JAVA.advocacy, Lew
<lew@xxxxxxxxxxx>
wrote in message
on Sat, 31 Mar 2007 14:24:56 -0400
<koydnUqbGvfkOpPbnZ2dnUVZ_h3inZ2d@xxxxxxxxxxx>:
Abandon JAVA.util.Hashtable and JAVA.util.Vector. Use other JAVA.util.Map and
JAVA.util.List implementations instead, such as JAVA.util.HashMap and
JAVA.util.ArrayList, respectively.
While you're at it, do not use JAVA.util.Enumeration; stick with
JAVA.util.Iterator.
-- Lew
And of course the proper
method by which one should use these is
List
<T> v = new ArrayList
<T>();
to abstract the problem, whenever possible.
Of course it might be even better if we had a new interface
RandomAccessList (extends List, requires get(int) --
one of my pet peeves), but that might get a tad unwieldly.
--
#191, ewill3@xxxxxxxxxxx
"640K ought to be enough for anybody."
- allegedly said by Bill Gates, 1981, but somebody had to make this up!
--
Posted via a free
Usenet account from
http://www.teranews.com
| From: asjbiotek |
Date: Wednesday, April 04, 2007
|
wrote in message:
Abandon JAVA.util.Hashtable and JAVA.util.Vector. Use other JAVA.util.Map and
JAVA.util.List implementations instead, such as JAVA.util.HashMap and
JAVA.util.ArrayList, respectively.
While you're at it, do not use JAVA.util.Enumeration; stick with
JAVA.util.Iterator.
-- LewSorry, but I'm so used to it (I'm an old timer from the mid-1990s)
that I just can not stop myself...you should see my MIDP apps...just
littered with
vector s they are ;-)
| From: Lew |
Date: Wednesday, April 04, 2007
|
wrote in message:
Abandon JAVA.util.Hashtable and JAVA.util.Vector. Use other JAVA.util.Map and
JAVA.util.List implementations instead, such as JAVA.util.HashMap and
JAVA.util.ArrayList, respectively.
While you're at it, do not use JAVA.util.Enumeration; stick with
JAVA.util.Iterator.
wrote in message:
Sorry, but I'm so used to it (I'm an old timer from the mid-1990s)
that I just can not stop myself...you should see my MIDP apps...just
littered with vectors they are ;-)
I should've said
J2ME excepted. Good catch.
To be fair, there are times when those retiree classes are useful, although I
do prefer the nimbler Collections.synchronizedX() where appropriate. But a
wimpy "eschew" exhortation'd be less inspiring than the demagogic
"abandon", eh?
My problem isn't with JAVA 1.0 veterans, old-timer. I respect the
service
you provided our community and honor your sacrifice. (I have been
programming
JAVA professionally since 1999 myself; first starting learning it in about
'97. Used to have to make our bits by hand out of wood back then, ayep.)
My problem is with those whippersnappers who come fresh out of Struts 101 and
write Web apps with these hoary legacy classes. Who's teaching them this
stuff, at least who's doing so without explaining the appropriate contexts and
the differences from the next-gen Collections classes that have been around
for almost nine years now (~ 3/4 the public life and virtually all the popular
life of JAVA itself)?
Even Rip-van-Winkle JAVA programmers should know that the synchronization
overhead of Vector and Hashtable is unnecessary when ArrayList and HashMap are
available and the use is
thread local.
--
Lew
| From: asjbiotek |
Date: Saturday, April 07, 2007
|
wrote in message:
My problem isn't with JAVA 1.0 veterans, old-timer. I respect the service
you provided our community and honor your sacrifice. (I have been programming
JAVA professionally since 1999 myself; first starting learning it in about
'97. Used to have to make our bits by hand out of wood back then, ayep.)
--
Lew
1. No sacrifices, I have absolutely loved my time doing JAVA. Am into
JAVA ME nowadays, but I used to
jump all over the place, from smart
cards to Lego stuff even....
2. I beat you by only 2 years....started professionally 1997 doing
applets* ;-)
* which incredibly enough, even after years of abuse is still with us
today and thriving!
Next Message: Temporary Files Rant