public IItemList deleteItem(Item item) { if (this.first.equals(item)) { return rest.deleteItem(item); } else { return new PairItemList(this.first, rest.deleteItem(item)); } }
// 1 4 | 2 // public IItemList antiListe(IItemList items) { if (items instanceof EmptyItemList) { return this; } else { Item first = ((PairItemList) items).getFirst(); if (this.count(first) > 0) { IItemList itemlist = this.deleteItem(first); items = items.deleteItem(first); return itemlist.antiListe(items); // return this.antiListe(this.items.deleteItem(items.getFirst())); } else { return new PairItemList(this.first, this.rest.antiListe(items)); } } }