I'm not talking fancy things like closures or functional programming. I'm talking some of the basic interfaces in commonly used classes.
Exhibit A are the constructors for
JTree
and JList
. These take a Hashtable
and a Vector
. How long have we had Collections built into Java? So why don't JTree
and JList
use Map
and List
?Exhibit B are classes that still return
Enumeration
. For example, to get the contents of a ZipFile
you get an Enumeration
and have to work your way through it by hand. Now Java has the enhanced for-loop, there ought to be methods for returning a Collection
directly.I could go on, but I think you get the point - many of Java's own classes simply haven't been modernized to bring them in line with improvements elsewhere. And I get really irritated having to continue to write crufty old-fashioned code to deal with those deficiencies.
No comments:
Post a Comment