package de.tu_berlin.dos.arm.khaos.utils;

import java.util.LinkedList;

public class LimitedQueue<E> extends LinkedList<E> {

    public final int limit;

    public LimitedQueue(int limit) {

        this.limit = limit;
    }

    @Override
    public boolean add(E o) {

        super.add(o);
        while (size() > limit) { super.remove(); }
        return true;
    }
}