List<Chunk> (CharSequence text, int startOffsetInText) { List<Chunk> c = chunks; if (c == null) { int chunkCount = getChunkCount(); chunks = c = new ArrayList<>(chunkCount); for (int i = 0; i < chunkCount; i++) { int from = startOffset + i * CHUNK_CHARACTERS; int to = i == chunkCount - 1 ? endOffset : from + CHUNK_CHARACTERS; Chunk chunk = new Chunk(alignToCodePointBoundary(text, from + startOffsetInText) - startOffsetInText, alignToCodePointBoundary(text, to + startOffsetInText) - startOffsetInText); c.add(chunk); } } return c; }