package Models.Program;

import java.util.Queue;
import java.util.LinkedList;

public class GenericQueue<T> implements IQueue<T> {
    private Queue<T> queue;

    public GenericQueue() {
        this.queue = new LinkedList<T>();
    }

    public T dequeue() {
        return queue.poll();
    }

    public void enqueue(T value) {
        queue.add(value);
    }

    public String toString() {
        var sb = new StringBuilder();
        for (var item : queue) {
            sb.append(item);
            sb.append("\n");
        }
        return sb.toString();
    }

}
