public void deleteSection(int index) { if (size() <= 1) return; SectionRecord fillSpot = null; if (index == 0) fillSpot = records.get(1); if (index < size() - 1) { SectionRecord nextRecord = records.get(index + 1); if (nextRecord.usePreviousStyle()) nextRecord.setStyleName(records.get(index).getStyleName()); } ListIterator<SectionRecord> k = records.listIterator(index); k.next(); int newStartIndex = getSectionMeasure(index); k.remove(); if (fillSpot != null) { fillSpot.setIndex(measureToSlotIndex(newStartIndex)); } }