{"id":26932557,"url":"https://github.com/tornikegomareli/deque","last_synced_at":"2025-08-21T08:12:39.891Z","repository":{"id":266530866,"uuid":"625700017","full_name":"tornikegomareli/Deque","owner":"tornikegomareli","description":"🦸‍♂️A Deque collection type implemented with Swift's protocols: Sequence, Collection, MutableCollection, and BidirectionalCollection with using of circular buffer to maximize memory usage ","archived":false,"fork":false,"pushed_at":"2023-04-10T00:03:07.000Z","size":19,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-08T22:45:01.771Z","etag":null,"topics":["circular-buffer","collection-protocol","data-structures","deque","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tornikegomareli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-09T22:51:19.000Z","updated_at":"2025-02-21T19:28:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"d00d35d8-bb34-4a1a-adc6-ff91e6ff6028","html_url":"https://github.com/tornikegomareli/Deque","commit_stats":null,"previous_names":["tornikegomareli/deque"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/tornikegomareli/Deque","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tornikegomareli%2FDeque","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tornikegomareli%2FDeque/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tornikegomareli%2FDeque/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tornikegomareli%2FDeque/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tornikegomareli","download_url":"https://codeload.github.com/tornikegomareli/Deque/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tornikegomareli%2FDeque/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264502992,"owners_count":23618674,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circular-buffer","collection-protocol","data-structures","deque","swift"],"created_at":"2025-04-02T08:27:09.600Z","updated_at":"2025-07-09T20:36:45.292Z","avatar_url":"https://github.com/tornikegomareli.png","language":"Swift","readme":"\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://imgtr.ee/images/2023/04/09/nvqrl.png\" alt=\"Medium article banner\" width=\"648\" maxHeight=\"156\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Swift-5.7-brightgreen.svg\" /\u003e\n    \u003ca href=\"https://twitter.com/tornikegomareli\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Contact-@tornikegomareli-orange\" alt=\"Twitter: @tornikegomareli\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.linkedin.com/in/tornikegomareli/\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Contact-Linkedin-orange\" alt=\"Linkedin: @Linkedin\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nUsing a circular buffer as storage, the Deque custom collection type in Swift offers a double-ended queue data structure. At both ends of the queue, it enables efficient insertion and removal operations.\n\nThis implementation still requires some performance optimizations, such as lazy resizing and the use of a custom index type to prevent pointless range checks. Although I believe it is enough for my Medium article, which is the reason for this, and data structure is doing its job in this context, I may add more improvements in the future, solely for educational uses.\n\nPlease refrain from using this data structure in your projects as it is a long way from being ready for production.\n\n\n\n## Usage\n\nTo use Deque in your project, simply install it with SPM. Then, you can create a new instance of Deque with the desired capacity\n\n```swift\nvar deque = Deque\u003cInt\u003e(capacity: 10)\ndeque.prepend(1)\ndeque.append(1)\ndeque.removeLast()\ndeque.removeFirst()\n```\n\nYou can then use the append, prepend, removeFirst, and removeLast methods to add and remove elements from the deque.\n\nDeque also conforms to the Collection protocol and Sequence Protocol, so you can use it in any context that expects a collection or Sequence.\n\n## Contributing\n\nThis implementation is for educational purposes and created for an article. However, if you find any bugs or have any suggestions for improvements, feel free to submit an issue or pull request.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftornikegomareli%2Fdeque","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftornikegomareli%2Fdeque","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftornikegomareli%2Fdeque/lists"}