@Test public void removeFromStart() { init("x", "y"); separatedList.remove(0); assertList("y"); }
@Override public Cell remove(int index) { if (index == 0) { Cell result = myBaseList.remove(0); if (size() != 0) { myBaseList.remove(0); } return result; } else { myBaseList.remove(index * 2 - 1); Cell result = myBaseList.remove(index * 2 - 1); if (size() > index) { myBaseList.set(index * 2 - 1, createSeparator(get(index - 1), get(index))); } return result; } }
SeparatedCellList extends AbstractList<Cell> { @Override public Cell remove(int index) { if (index == 0) { Cell result = myBaseList.remove(0); if (size() != 0) { myBaseList.remove(0); } return result; } else { myBaseList.remove(index * 2 - 1); Cell result = myBaseList.remove(index * 2 - 1); if (size() > index) { myBaseList.set(index * 2 - 1, createSeparator(get(index - 1), get(index))); } return result; } } }
SeparatedCellList extends AbstractList<Cell> { @Override public Cell remove(int index) { if (index == 0) { Cell result = myBaseList.remove(0); if (size() != 0) { myBaseList.remove(0); } return result; } else { myBaseList.remove(index * 2 - 1); Cell result = myBaseList.remove(index * 2 - 1); if (size() > index) { myBaseList.set(index * 2 - 1, createSeparator(get(index - 1), get(index))); } return result; } } protected  SeparatedCellList(List<Cell> baseList); }
SeparatedCellList extends AbstractList<Cell> { @Override public Cell remove(int index) { if (index == 0) { Cell result = myBaseList.remove(0); if (size() != 0) { myBaseList.remove(0); } return result; } else { myBaseList.remove(index * 2 - 1); Cell result = myBaseList.remove(index * 2 - 1); if (size() > index) { myBaseList.set(index * 2 - 1, createSeparator(get(index - 1), get(index))); } return result; } } protected  SeparatedCellList(List<Cell> baseList); @Override Cell get(int index); @Override int size(); @Override void add(int index, Cell element); @Override Cell remove(int index); @Override Cell set(int index, Cell element); }
SeparatedCellList extends AbstractList<Cell> { @Override public Cell remove(int index) { if (index == 0) { Cell result = myBaseList.remove(0); if (size() != 0) { myBaseList.remove(0); } return result; } else { myBaseList.remove(index * 2 - 1); Cell result = myBaseList.remove(index * 2 - 1); if (size() > index) { myBaseList.set(index * 2 - 1, createSeparator(get(index - 1), get(index))); } return result; } } protected  SeparatedCellList(List<Cell> baseList); @Override Cell get(int index); @Override int size(); @Override void add(int index, Cell element); @Override Cell remove(int index); @Override Cell set(int index, Cell element);  }