public class Node {
public Node next;
public Node previous;
private int data;// 节点中存放的数据
public Node(int data) {
this.data = data;
}
public String toString() {// 覆盖该方法,用来打印该节点
return data + "";
}
public boolean equals(Object other) {
// 进行两个节点的比较
Node temp = null;
if (other instanceof Node) {
// 判断是否是Node类型
temp = (Node) other;
// 进行数据的比较
if (temp.getData() == this.getData()) {
return true;
} else {
return false;
}
} else {
return false;
}
}
private int getData() {
// TODO Auto-generated method stub
return data;
}
}
public Node next;
public Node previous;
private int data;// 节点中存放的数据
public Node(int data) {
this.data = data;
}
public String toString() {// 覆盖该方法,用来打印该节点
return data + "";
}
public boolean equals(Object other) {
// 进行两个节点的比较
Node temp = null;
if (other instanceof Node) {
// 判断是否是Node类型
temp = (Node) other;
// 进行数据的比较
if (temp.getData() == this.getData()) {
return true;
} else {
return false;
}
} else {
return false;
}
}
private int getData() {
// TODO Auto-generated method stub
return data;
}
}