List { public boolean removeItems(java.util.List<ListItem> items) { boolean listChanged = false; for (ListItem item : items) { TextListItemElement itemElement = item.getOdfElement(); OdfFileDom ownerDocument = (OdfFileDom) listElement.getOwnerDocument(); Document doc = (Document) ownerDocument.getDocument(); doc.removeElementLinkedResource(itemElement); Node removedNode = listElement.removeChild(itemElement); if (removedNode != null) { listChanged = true; } } return listChanged; } List(TextListElement element);  List(ListContainer container);  List(ListContainer container, ListDecorator decorator);  List(ListContainer container, String header, ListDecorator decorator);  List(ListContainer container, String header, boolean isContinueNumbering, ListDecorator decorator);  List(ListContainer container, String header, List continueList, ListDecorator decorator); ListType getType(); String getHeader(); void setHeader(String header); void setDecorator(ListDecorator decorator); ListItem addItem(String itemContent); ListItem addItem(int location, String itemContent); ListItem addItem(ListItem item); ListItem addItem(int location, ListItem item); java.util.List<ListItem> addItems(String[] items); java.util.List<ListItem> addItems(int location, String[] items); java.util.List<ListItem> addItems(ListItem[] items); java.util.List<ListItem> addItems(int location, ListItem[] items); ListItem getItem(int location); java.util.List<ListItem> getItems(); int size(); ListItem set(int location, ListItem item); ListItem set(int location, String itemContent); boolean removeItem(int location); boolean removeItem(ListItem item); boolean removeItems(java.util.List<ListItem> items); void clear(); void remove(); boolean isContinueNumbering(); void setContinueNumbering(boolean isContinueNumbering); List getContinueList(); void setContinueList(List continueList); int getLevel(); TextListElement getOdfElement(); @Override String toString();  }
@Test public void testRemoveItems() { try { TextDocument odtdoc = (TextDocument) TextDocument.loadDocument(ResourceUtilities .getTestResourceAsStream(SAMPLE_LIST_DOCUMENT)); Iterator<List> listIterator = odtdoc.getListIterator(); List list; if (listIterator.hasNext()) { list = listIterator.next(); ListItem item0 = list.getItem(0); ListItem item1 = list.getItem(1); Assert.assertFalse(item0.getOdfElement() == item1.getOdfElement()); Assert.assertTrue(list.removeItem(0)); item0 = list.getItem(0); Assert.assertTrue(item0.getOdfElement() == item1.getOdfElement()); item1 = list.getItem(1); Assert.assertFalse(item0.getOdfElement() == item1.getOdfElement()); list.removeItem(item0); item0 = list.getItem(0); Assert.assertTrue(item0.getOdfElement() == item1.getOdfElement()); java.util.List<ListItem> newItems = new java.util.ArrayList<ListItem>(); newItems.add(list.addItem("new item1")); newItems.add(list.addItem("new item2")); list.removeItems(newItems); Assert.assertTrue(item0.getOdfElement() == list.getItem(0).getOdfElement()); } else { Assert.fail("list iterate fail."); } if (listIterator.hasNext()) { list = listIterator.next(); Assert.assertTrue(list.size() > 0); list.clear(); Assert.assertTrue(list.size() == 0); } else { Assert.fail("list iterate fail."); } } catch (Exception e) { Logger.getLogger(ListTest.class.getName()).log(Level.SEVERE, null, e); Assert.fail(e.getMessage()); } }