Recall that the InsertParagraphTag method makes a copy of lines into newlines with this code:
newlines = new ArrayList();
We should be able to do this edit directly into the lines variable, by using InsertRange instead of AddRange. To make it work completely, however, is a pretty big edit: there might be various places that rely on newlines . So I decided that first I would make the InsertRange work and only then remove newlines . To accomplish that, I wrote this code:
newlines = new ArrayList(lines);
That leaves the result in the newlines variable, so this is the only code that has to change to test things. And sure enough, it worked just fine! The next step was just to replace all references to newlines with references to lines . I did a few of those with a quick text find ”where, oh where, is Smalltalk s Browse References ? Then I removed the instance variable newlines , compiled (finding one more reference), and the program still runs all the tests, even the acceptance test that we haven t told you about yet.