void (int start, int end) { for (int i = start; i < end; i++) { char c = myRawText.charAt(i); switch (c) { case '<' -> myResultBuffer.append("&lt;"); case '>' -> myResultBuffer.append("&gt;"); case '&' -> myResultBuffer.append("&amp;"); case ' ' -> myResultBuffer.append("&#32;"); case '\n' -> { myResultBuffer.append("<br>"); myCurrentColumn = -1; // -1 is because we increment myCurrentColumn right after the switch } case '\t' -> { int newColumn = (myCurrentColumn / myTabSize + 1) * myTabSize; for (; myCurrentColumn < newColumn; myCurrentColumn++) myResultBuffer.append("&#32;"); } default -> myResultBuffer.append(c); } myCurrentColumn++; } }