forked from IF-LK-2020/queue-stack
push and pop implemented
This commit is contained in:
parent
32efc279c7
commit
66b0010484
BIN
Stack.class
BIN
Stack.class
Binary file not shown.
|
@ -8,11 +8,16 @@ public class Stack<ContentType> {
|
|||
|
||||
|
||||
public void push( ContentType pContentObject ) {
|
||||
// TODO: Implementiere push
|
||||
if (head != null) {
|
||||
StackNode<ContentType> node = new StackNode<ContentType>(pContentObject);
|
||||
node.setNext(head);
|
||||
head = node;
|
||||
} else {
|
||||
head = new StackNode<ContentType>(pContentObject);
|
||||
}
|
||||
}
|
||||
|
||||
public void pop() {
|
||||
// TODO: Implementiere pop
|
||||
if( head != null ) {
|
||||
head = head.getNext();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue