If there is a String Buffer, and a String Builder based on array technology, why then is there no equivalent mutable data type based on a Linked List? Or is there?
The performance of
StringBuilder is sufficient for most common purposes. Arrays work quite well when you are mostly appending small strings to the end of a string, and that is a very natural way for strings to be constructed in most applications.
If you want to deal with long strings that support more general editing operations quickly, then you will probably be interested in ropes. You might also want to look a gap buffer which is a more specialized data structure.
I just created my own class based on this idea, and found that a class based on a linked list is much less efficient in runtime than the built in String Builder, and String Buffer classes. Thanks for the post on ropes and gap buffers, I will look at them.
We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.