diff --git a/src/main/java/telraam/logic/positioner/CircularQueue.java b/src/main/java/telraam/logic/positioner/CircularQueue.java index 94cadec..773c633 100644 --- a/src/main/java/telraam/logic/positioner/CircularQueue.java +++ b/src/main/java/telraam/logic/positioner/CircularQueue.java @@ -5,26 +5,17 @@ public class CircularQueue extends LinkedList { private final int maxSize; - private int size = 0; - public CircularQueue(int maxSize) { this.maxSize = maxSize; } @Override public boolean add(T e) { - if (this.size >= this.maxSize) { + if (size() >= this.maxSize) { removeFirst(); - this.size--; - } - - boolean result = super.add(e); - - if (result) { - this.size++; } - return result; + return super.add(e); } }