List<SoftWrapImpl> (int offset) { int startIndex = getSoftWrapIndex(offset); if (startIndex < 0) { startIndex = -startIndex - 1; } if (startIndex >= myWraps.size()) { return Collections.emptyList(); } List<SoftWrapImpl> tail = myWraps.subList(startIndex, myWraps.size()); List<SoftWrapImpl> result = new ArrayList<>(tail); tail.clear(); return result; }