Stack e Queue completati, compreso il toString. Versione sia array che lista.
This commit is contained in:
@@ -64,10 +64,7 @@ public class NodeQueue<E> implements Queue<E> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFull() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
@@ -78,8 +75,7 @@ public class NodeQueue<E> implements Queue<E> {
|
||||
@Override
|
||||
public String toString() {
|
||||
Node<E> temp;
|
||||
String to_return = "";
|
||||
if (!isEmpty()){
|
||||
String to_return = "[";
|
||||
for (temp = front;temp != null;temp = temp.getNext()){
|
||||
to_return+=temp.getElement();
|
||||
if (temp.getNext() != null){
|
||||
@@ -87,8 +83,8 @@ public class NodeQueue<E> implements Queue<E> {
|
||||
}
|
||||
|
||||
}
|
||||
to_return += "]";
|
||||
|
||||
}
|
||||
return to_return;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user