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?

Recommended Answers

All 2 Replies

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.

commented: Ropes & Gap Buffer... very interesting, thanks. +15

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.