Should LinkedHashMap expose the Entries subclass

Paulo Levi i30817 at gmail.com
Sat Aug 18 14:20:48 UTC 2012


Excuse the spelling, 'change' -> 'chance', 'iterator failsafe iterator' ->
'iterator failsafe'

On Sat, Aug 18, 2012 at 3:18 PM, Paulo Levi <i30817 at gmail.com> wrote:

> I'm trying to subclass LinkedHashMap so i can add new indexed iterator
> methods:
> ListIterator from(E e)
>
> So, getEntry(e) is package protected and i though 'easy, since the entries
> in this map are nodes on the list i can easily use that to make a iterator
> by placing my subclass on the 'java.util' namespace'.
>
> Not so fast; both header (the linked list guardian), modcount (the
> iterator failsafe iterator data) and more importantly the double linked
> Entry subclass are all private - so it seems my subclass is going to become
> a mess of reflection and my access times will suffer consequentially
> (though probably not as bad as copying the data).
>
> What i'm asking is if is there any change of the 'Linked' subclasses
> either returning a list iterator on their iterators, or at least making the
> internal data fields protected or package protected?
>



More information about the discuss mailing list