我现在有点困惑,我需要为 OrderedList 类编写删除方法,这就是我到目前为止所拥有的
boolean remove(E obj) {
ListIterator<E> iter = theList.listIterator();
while (iter.hasNext()){
if (obj.compareTo(iter.next()) == 0) {
}
}
return false;
}
我了解该算法如何通过使下一项等于前一项来工作,但我只是不确定如何实现它。
最佳答案
https://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html
boolean remove(Object o)
Removes the first occurrence of the specified element from this list, if it is present.
关于java - 如何为 OrderedList 类编写 boolean 删除方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52694060/