javastringbuilderropes

StringBuilder vs Ropes


Good morning,

I am writing a language parser, and am looking for the best structure to use for a rollback cache which currently does the following:

So in short, I would love to know which you feel to be the best data structure for:

I hope to hear from you soon!


Solution

  • If I were you, for such a specialised use and with possible performance and resource constraints, I'd implement my own buffer from primitives. I think it's more trouble adapting existing structures. Of course, if it didn't hurt, I'd try to conform to the well known relevant interfaces, such as CharSequence, Appendable, List, etc.