forked from IF-LK-2020/queue-stack
Compare commits
1 Commits
66b0010484
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72de362126 |
@@ -10,10 +10,10 @@ public class Queue<ContentType> {
|
|||||||
|
|
||||||
public void enqueue( ContentType pContentObject ) {
|
public void enqueue( ContentType pContentObject ) {
|
||||||
if (head == null) {
|
if (head == null) {
|
||||||
head = new QueueNode<ContentType>(pContentObject);
|
head = new QueueNode<>(pContentObject);
|
||||||
tail = head;
|
tail = head;
|
||||||
} else {
|
} else {
|
||||||
QueueNode<ContentType> node = new QueueNode<ContentType>(pContentObject);
|
QueueNode<ContentType> node = new QueueNode<>(pContentObject);
|
||||||
tail.setNext(node);
|
tail.setNext(node);
|
||||||
tail = node;
|
tail = node;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ public class Stack<ContentType> {
|
|||||||
|
|
||||||
public void push( ContentType pContentObject ) {
|
public void push( ContentType pContentObject ) {
|
||||||
if (head != null) {
|
if (head != null) {
|
||||||
StackNode<ContentType> node = new StackNode<ContentType>(pContentObject);
|
StackNode<ContentType> node = new StackNode<>(pContentObject);
|
||||||
node.setNext(head);
|
node.setNext(head);
|
||||||
head = node;
|
head = node;
|
||||||
} else {
|
} else {
|
||||||
head = new StackNode<ContentType>(pContentObject);
|
head = new StackNode<>(pContentObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user