import { Queue } from "https://deno.land/x/fathym_common@v0.2.165-integration/src/common/iterables/Queue.ts";
This is a simple implementation of a queue data structure.
Examples
From direct import
From direct import
import { Queue } from "@fathym/common/iterables";
const queue = new Queue<number>();
queue.Enqueue(1);
queue.Enqueue(2);
queue.Dequeue(); // Output: 1
queue.Peek(); // Output: 2
queue.Dequeue(); // Output: 2
queue.IsEmpty(); // Output: true
From common import
From common import
import { Queue } from "@fathym/common";
const queue = new Queue<number>();
queue.Enqueue(1); // Output: 1
queue.Enqueue(2); // Output: 2
queue.Dequeue(); // Output: 1
queue.Dequeue(); // Output: 2
Properties
private
items: T[]