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 ) {
|
||||
if (head == null) {
|
||||
head = new QueueNode<ContentType>(pContentObject);
|
||||
head = new QueueNode<>(pContentObject);
|
||||
tail = head;
|
||||
} else {
|
||||
QueueNode<ContentType> node = new QueueNode<ContentType>(pContentObject);
|
||||
QueueNode<ContentType> node = new QueueNode<>(pContentObject);
|
||||
tail.setNext(node);
|
||||
tail = node;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,11 @@ public class Stack<ContentType> {
|
||||
|
||||
public void push( ContentType pContentObject ) {
|
||||
if (head != null) {
|
||||
StackNode<ContentType> node = new StackNode<ContentType>(pContentObject);
|
||||
StackNode<ContentType> node = new StackNode<>(pContentObject);
|
||||
node.setNext(head);
|
||||
head = node;
|
||||
} else {
|
||||
head = new StackNode<ContentType>(pContentObject);
|
||||
head = new StackNode<>(pContentObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user