This question already has an answer here:example code:Question:will the literal string "hi" somehow stay in memory, even after the StringBuffer has been garbage collected? Or is it just used to create a char array for the StringBuffer and then never put anywhere in memory?
(I come from the python world, so I apologise if some of the terminology I use jars with the norm.)I have a String with a List of start/end indices to replace. Without getting too much into detail, consider this basic mockup: