/** * Removes the given node from this group. * * @param node the node to be removed * @return true, if the node was removed */ public boolean remove(T node) { Assert.notNull(node, "node"); boolean removed = nodeList.remove(node); if (removed) { notifyRemoved(node); } return removed; }
public void testAddAndRemoveAndSize() { assertEquals(_nodeList.size(), 0); _nodeList.add(_attribute1); assertEquals(_nodeList.size(), 1); _nodeList.add(_attribute2); assertEquals(_nodeList.size(), 2); _nodeList.add(_attribute3); assertEquals(_nodeList.size(), 3); _nodeList.add(_attribute4); assertEquals(_nodeList.size(), 4); _nodeList.remove(_attribute1); assertEquals(_nodeList.size(), 3); _nodeList.removeAll(); assertEquals(_nodeList.size(), 0); }
/** * Removes the given product from this product manager if it exists. * * @param product the product to be removed, ignored if <code>null</code> * @return true, if the product was removed */ public boolean removeProduct(Product product) { if (product != null) { int index = productList.indexOf(product); if (index >= 0) { if (productList.remove(product)) { productList.clearRemovedList(); product.removeProductNodeListener(productNodeNameChangeListener); product.resetRefNo(); clearProductManager(product); fireEvent(product, PRODUCT_REMOVED); return true; } } } return false; }