Browse Source

implemented methods

master
David 2 years ago
parent
commit
a60a180445
1 changed files with 10 additions and 2 deletions
  1. +10
    -2
      src/ChainQueue.java

+ 10
- 2
src/ChainQueue.java View File

@@ -33,7 +33,7 @@ public class ChainQueue<E> implements Queue<E> {

}

Node<E> node;
Node<E> node; // first item

@Override
public boolean add(E input) { // Übergeben der "Data"
@@ -144,7 +144,12 @@ public class ChainQueue<E> implements Queue<E> {

@Override
public E poll() {
return null;
E temp = null;
if (!this.isEmpty()) {
temp = node.getData();
node = node.getNext();
}
return temp;
}

@Override
@@ -154,6 +159,9 @@ public class ChainQueue<E> implements Queue<E> {

@Override
public E peek() {
if (!this.isEmpty()) {
return node.getData();
}
return null;
}


Loading…
Cancel
Save