请帮忙看看!!!!

Linkyo Linkyo 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
LinearNode类:
public class LinearNode {
private LinearNode next;
private Object element;

public LinearNode(){
this.next = null;
this.element = null;
}

public LinearNode(Object obj){
this.next = null;
this.element = obj;
}

public void setNext(LinearNode node){
this.next = node;
}

public LinearNode getNext(){
return this.next;
}

public void setElement(Object obj){
this.element = obj;
}

public Object getElement(){
return this.element;
}

}

OrderList类
import myiterator.Iterator;
import myexception.NoSuchElementException;
import myexception.EmptyListException;

public class OrderList implements OrderListADT {
private int count;
private LinearNode head,end;

public OrderList(){
this.count = 0;
this.head = null;
this.end = null;
}

public int size(){
return count;
}

public boolean isEmpty(){
return count == 0;
}

public Object removeFirst() throws EmptyListException {
if(this.isEmpty())
throw new EmptyListException("Empty List");

Object obj = head.getElement();
head = head.getNext();
count--;

if(isEmpty())
end = null;

return obj;
}


public Object removeLast() throws EmptyListException {
if(isEmpty())
throw new EmptyListException("Empty List");

Object obj;
if(size() == 1){
obj = head.getElement();
head = end = null;
count--;
}
else{
LinearNode current = head;
for(int skip = 0;skip < count - 2;skip++)
current = current.getNext();

obj = end.getElement();
end = current;
count--;
}

return obj;

}

public Object remove(Object obj) throws EmptyListException,NoSuchElementException {
if(isEmpty())
throw new EmptyListException("Empty List");

LinearNode current = head,pervious = null;
boolean found = false;


while(current.getElement() != null && !found){
if(current.getElement().equals(obj)){
found = true;
}
else{
pervious = current;
current = current.getNext();
}
}

if(!found)
throw new NoSuchElementException("No Such Element");

if(size() == 1)
head = end = null;
else{
if(current.equals(end))
end = pervious;
else{
pervious.setNext(current.getNext());
}
}


obj = current.getElement();

count--;
return current.getElement();
}

public Object first() throws EmptyListException{
if(isEmpty())
throw new EmptyListException("Empty List");

Object obj = head.getElement();

return obj;
}

public Object last() throws EmptyListException{
if(isEmpty())
throw new EmptyListException("Empty List");

Object obj = end.getElement();

return obj;
}

public Iterator iterator(){
return new ListIterator(head,size());
}

public void add(Comparable element){
LinearNode node = new LinearNode(element);
if(isEmpty()){
head = node;
end = head;
}
else{
LinearNode current = head,pervious = null;
boolean found = false;

while(current != null && !found){
if(element.compareTo(current.getElement()) > 0){
pervious = current;
current = current.getNext();
}
}
node.setNext(current);
pervious.setNext(node);
}

count++;

}

public String toString(){
Iterator iterator = this.iterator();
StringBuffer result = new StringBuffer();
while(iterator.hasNext()){
try{
result.append(iterator.next());
}
catch(NoSuchElementException e){
e.printStackTrace();
}
}

return result.toString();
}

}
出现问题
注意: E:\JavaCode\LinearList\OrderList.java 使用了未经检查或不安全的操作。
注意: 要了解详细信息,请使用 -Xlint:unchecked 重新编译。
用后出现
OrderList.java :133 : 警告[Unchecked] 对作为普通类型java.lang.Comparable的成员的
CompareTo<T>的调用未经检查
if(element.compareTo(current.getElement()) > 0)
...全文

相关推荐

WEB项目(日本)(有意者请下载)

一个正规的压缩版java项目,如果有谁对“对日项目”感兴趣地话就请下载,这里我用的是IBM的WebSphere Studio和DB2开发的。有关设项书等资料我会在其它地方上传的!!!!

kesuichong

36、深度神经网络训练中的正则化技术

本文详细介绍了深度神经网络训练中常用的正则化技术,包括ℓ1和ℓ2正则化、丢弃法(Dropout)、蒙特卡罗丢弃法(MC Dropout)和最大范数正则化(Max-Norm Regularization)。文章从原理、代码实现、优缺点以及应用建议等方面进行了全面阐述,并提供了完整的代码示例和常见问题的解决方案。通过合理使用这些正则化技术,可以有效防止模型过拟合,提高模型的泛化能力和性能。

w1x2y3

ESC压缩JAVASCRIPT

如何批量压缩JAVASCRIPT?<br><br>!!!!使用前请先到设置参数段设置一下参数!!!!<br><br>用法:在WINDOWS下,将想压缩的JAVASCRIPT脚本拖放至此RUN.BAT上<br><br>之后将会进行一次性批量压缩,压缩后的脚本为原脚本路径下/C_原文件名<br><br>仅仅是为了让大家更方便的利用ESC.wsf压缩JAVASCRIPT,所以请大家保护原作者的权益。<br><br>欢迎大家使用此脚本,但请不要更改作者与出处<br><br>注:此脚本调用ESC.wsf压缩核心,用于批量压缩JAVASCRIPT脚本<br><br>AUTHOR:LIMING [leession@live.cn]

leession

anki恋恋有词NEW.apkg

恋练有词,anki使用,xb购买仅供参考使用,24小时内请删除!!!!

tf1997

dps8m-planb:备份SourceForge dps8m

!!!! 在下载任何文件之前,请阅读此内容!!!! 关于DPS8 GIT源代码树,存在许多误解。 有时会导致不幸的用户沮丧。 GIT的规范用法通常具有master分支,其中包含“发行版”。 他们预计将“准备出发”。 开发发生在分支机构上; 开发分支完成后,将其作为发行版移至主分支。 DPS8仿真器项目不遵循该模型。 由于只有少数开发人员,并且任何“发行版”都是无法想象的未来中的希望梦想,所以master分支是最前沿的开发代码。 master分支上的提交点可能在进行提交的人的机器上编译,但是没有功能,可移植性,正确性,更新过程,测试甚至编译的承诺。 Alpha 1.0发行版是作为master分支上的标签完成的; 对于我们而言,这是很糟糕的计划,因为它难以应用错误修复程序来生成1.1版本。 Alpha 2.0发行版作为一个分支而完成。 这样可以将错误修复程序从master分支中合并到一起

花菌子
评论
收藏 已收藏
分享
返回顶部
Linkyo
Java SE 62,621 成员 307,251 内容