Hmm, Last I looked at the java LinkedList implementation, a LinkedList<E>
comprised a number of Entry<E> nodes, each of which contained an element of
type E, plus previous and next pointer.  So the Node types are distinct
from the containing List type.

But you're quite right, a (Singly) Linked List could be implemented with a
mutable tail, although that would prevent the data sharing that's one of
the more useful properties of the structure.


On 29 July 2012 17:36, Ricky Clarkson <[email protected]> wrote:

> Mutability in a singly linked list does not require any extra objects or
> fields.
>
> Another example of immutability-first,
> http://functionaljava.googlecode.com/svn/artifacts/3.0/javadoc/fj/data/List.htmland
>  its nested mutable counterpart, Buffer.
>
>
> On Sun, Jul 29, 2012 at 12:19 PM, Kevin Wright 
> <[email protected]>wrote:
>
>> Not entirely so!
>>
>> The "tracker" is another level of indirection, purposely added to the
>> structure with the intent of making it mutable.
>>
>> I'm quite sure that I was referring to immutable linked lists.
>> Immutability isn't simply mutability with extra runtime exceptions, when a
>> framework is built with immutability at it's core it works very differently.
>>
>> The only place I know that does this in Java (the Lang) is joda time.
>> Even guava lies by claiming that an immutable list is a subclass of a
>> mutable one.
>> On Jul 29, 2012 3:54 PM, "Ricky Clarkson" <[email protected]>
>> wrote:
>>
>>> Now, now, children.  It's clear to this bystander that Reinier's
>>> 'tracker object' is the same as Kevin's 'tail object'.  It's also clear
>>> that there's nobody on this list/group who doesn't know what a linked list
>>> is so there's no real need to accuse each other of that.
>>>
>>> On Sun, Jul 29, 2012 at 11:32 AM, Reinier Zwitserloot <
>>> [email protected]> wrote:
>>>
>>>> No, _THIS_ post is a strawman post. You jump from cliche to cliche
>>>> without explaining how these cliches are in any way relevant to TCO. What
>>>> the heck does the '9 pregnant women can't produce a baby in 1 month'
>>>> schtick have to do with TCO? What does 'goto considered harmful' have to do
>>>> with any of this? Neither scala nor java has gotos, so.... huh?!?????
>>>>
>>>> You're just naming random programming koans here.
>>>>
>>>> On Monday, July 23, 2012 9:27:33 AM UTC+2, KWright wrote:
>>>>>
>>>>>
>>>>> p.s. A immutable linked-list is just a series of "cells", each one
>>>>> holding a value and the rest of the list.  All except the last one.  
>>>>> Unless
>>>>> your mention of "tracker objects" is simply a synonym for these tail
>>>>> objects, then I suspect you may have misunderstood how the structure is
>>>>> implemented.
>>>>>
>>>>>
>>>> Have a look at the implementation of java.util.LinkedList. 1 tracker
>>>> object per cell.
>>>>
>>>> I suspect _you_ may have misunderstood how the structure is implemented.
>>>>
>>>>
>>>>

-- 
You received this message because you are subscribed to the Google Groups "Java 
Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to