- Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathNode.java
More file actions
Latest commit
34 lines (29 loc) · 630 Bytes
/
Copy pathNode.java
File metadata and controls
34 lines (29 loc) · 630 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
publicclassNode {
intdata;
Nodenext, prev;
publicNode() {
data = 0;
next = prev = null;
}
publicNode(intdata) {
this.data = data;
next = prev = null;
}
publicNode(Nodex) {
data = x.data;
next = x.next;
prev = x.prev;
}
@Override
publicinthashCode() {
returndata;
}
@Override
publicbooleanequals(Objectobj) {
if (objinstanceofNode) {
Noden = (Node) obj;
returndata == n.data;
} else
returnfalse;
}
}