commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rich Dougherty <r...@rd.gen.nz>
Subject Re: [collections] [patch] NodeCachingLinkedList
Date Thu, 19 Dec 2002 00:16:28 GMT
> Here is a patch to resolve the license issues with
> NodeCachingLinkedList. Included in this patch is:
> 
> - CommonsLinkedList, a version of java.util.LinkedList that we can
>   distribute with [collections].
> 
>   A few points about this class:
> 
>     [snip]
> 
>   - It extends LinkedList rather than AbstractSequentialList. Since it
>     doesn't override every method of List there will be problems if
>     LinkedList overrides more methods in the future. (This was a
>     problem with the old implementation of NodeCachingLinkedList too.)
> 
>     Also, extending LinkedList takes up a little bit more memory.

I'm replying to myself on this one. :-)

When I was writing CommonsLinkedList I had to decide whether it should
extend AbstractSequentialList or LinkedList. By extending LinkedList we
allow CommonsLinkedList (and subclasses) to be used as a drop-in
replacement for existing LinkedLists. It would be nicer if LinkedList
was an interface since we're not actually using any of LinkedList's
implementation, instead we're just replacing it. That's why I thought
I'd mention it as a something that might want to be considered before
adding CommonsLinkedList.

Anyway, I've just noticed CursorableLinkedList also provides the
LinkedList operations, but it doesn't extend LinkedList. Since this is
pretty much the same situation as CommonsLinkedList we might want to aim
for consistency. In other words we should probably get both to extend
LinkedList, or just leave both as normal Lists.

Rich

Mime
View raw message