Skip to content

Enhance CTQueue with complete Queue operations and improved API with Tests #12

Open
@Alokzh

Description

@Alokzh

Description :

The current CTQueue implementation provides stack functionality but lacks several important features.

Proposed Enhancements:

  • enqueue: - Clear alias for add: (standard queue terminology)
  • dequeue - Clear alias for remove (standard queue terminology)
  • dequeueUpTo: - Remove Multiple element at once
  • dequeueIfNone: - Alternative to removeIfNone: with queue terminology
  • front - Alternative to peek that throws an error when empty instead of returning nil
  • rear - Access the most recently added element without removing it
  • isEmpty - Check if the queue has no elements
  • grow: - Ensure the queue has at least specified capacity
  • reversed - Return a new queue with elements in reverse order
  • withAll: - Create a new queue with specified elements
  • capacity: - Set or ensure capacity for expected number of elements
  • asArray - Convert queue to an array
  • copy - Create a copy of the queue
  • copyEmpty - Create an empty copy of the queue
  • clear - Remove all elements from the queue
  • capacity - Get current capacity of the underlying collection
  • emptyError - Standardized error handling for empty queue operations
  • printOn: - Provide better string representation of the queue

Testing:

Add Tests for all the newly implemented methods & also improve already implemented tests if necessary.

Note: This is the first set of planned improvements. More enhancements & Tests will be added moving forward

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions