-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyDoublyLinkedData.java
41 lines (33 loc) · 1.04 KB
/
MyDoublyLinkedData.java
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
35
36
37
38
39
40
41
public class MyDoublyLinkedData {
private String key;
private String data;
MyDoublyLinkedData next;
MyDoublyLinkedData prev;
MyDoublyLinkedData(String key, String data){
this.key = key;
this.data = data;
}
public String getKey(){
return this.key;
}
public String getData(){
return this.data;
}
public void setKey(String key){
this.key = key;
}
public void setData(String data){
this.data = data;
}
public String toStringSimple(){
String str = "[" + this.key + "] " + this.data + ": prev [";
str = str + (this.prev != null ? this.prev.getKey() : "null");
str = str + "]: next[";
str = str + (this.next != null ? this.next.getKey() : "null");
str = str + "]";
return str;
}
public String toStringNodeData(){
return "prev:[" + ((this.prev==null) ? "null" : this.prev.getKey()) + "] current:[" + this.key + "] next:[" + ((this.next==null) ? "null" : this.next.getKey()) + "]";
}
}