Jeremias Maerki wrote:
Frankly, I'm less than thrilled. I appreciate the good will behind this
but I'd have appreciated some advance warning, too. My concern is that:
- ListElement last = (ListElement)contentList.getLast();
is much easier to read and write than:
+ ListElement last = (ListElement) contentList
+ .get(contentList.size() - 1);
It may even be faster, unless LinkedList specifically optimizes
get(contentList.size() - 1).
Well, I think a List should be used if only List methods are needed,
and a specialized subclass should be used if methods of the subclass
have to be used.
Years ago, while I replaces Java 1.1 collection classes with 1.2 I
learned that replacing unnecessary use of specialized subclasses with
more generic classes without a tool is rather difficult. I vaguely
remember of a commercial tool which can report unnecessary use of
specialized subclasses (in general), as well as unnecessary broad
access control (i.e. public when protected is sufficient).
Does anybody of an open source tool which does this too?
J.Pietschmann