From f71ad1ba1f9e0c4791352ffbe09553693d8fcede Mon Sep 17 00:00:00 2001
From: Topvennie <vincent@vallaeys.com>
Date: Fri, 29 Mar 2024 14:21:09 +0100
Subject: [PATCH] use built in function

---
 .../telraam/logic/positioner/CircularQueue.java     | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

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<T> extends LinkedList<T> {
 
     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);
     }
 
 }