Node
и запустили наш DoublyLinkedList
. Давайте добавим два метода в наш дважды связанный список, называемый add
и remove
. add
метод должен добавить данный элемент в список , а remove
метод должен удалить все вхождения данного элемента в списке. Будьте внимательны при обработке этих возможных случаев, например, для удаления первого или последнего элемента. Кроме того, удаление любого элемента в пустом списке должно возвращать значение null
.