Int2IntMap (CharSequence text, int start, int end) { Int2IntMap result=new Int2IntOpenHashMap(); int line = 0; if (end > text.length()) { end = text.length(); } for (int i = start; i < end; i++) { char c = text.charAt(i); switch (c) { case '\n' -> line++; case '\\' -> result.put(line, 1); } } return result; }