- Hands-On Data Structures and Algorithms with JavaScript
- Kashyap Mukkamala
- 134字
- 2021-06-30 19:12:12
Implementing APIs
Implementing an API is never as easy as it seems, as discussed earlier. When making generic classes, we can never predict what kinds of a situation our queue is going to be used in. With that in mind, let's create a very generic API for our queue and expand it in future as we see fit. Some of the most common operations that we can add to the queue are as follows:
- add(): Pushes an item to the back of the queue
- remove(): Removes an item from the start of the queue
- peek(): Shows the last item added to the queue
- front(): Returns the item at the front of the queue
- clear(): Empties the queue
- size(): Gets the current size of the queue
推薦閱讀
- Java面向對象軟件開發
- Practical UX Design
- Pandas Cookbook
- MATLAB 2020 從入門到精通
- 老“碼”識途
- Hands-On RESTful Web Services with Go
- 單片機應用與調試項目教程(C語言版)
- QGIS By Example
- Nginx實戰:基于Lua語言的配置、開發與架構詳解
- BeagleBone Black Cookbook
- HTML 5與CSS 3權威指南(第3版·上冊)
- Python爬蟲、數據分析與可視化:工具詳解與案例實戰
- Python Machine Learning Blueprints:Intuitive data projects you can relate to
- Learning Grunt
- Python數據科學實踐指南