- 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
推薦閱讀
- R語言數據可視化之美:專業圖表繪制指南
- Oracle 12c中文版數據庫管理、應用與開發實踐教程 (清華電腦學堂)
- Linux環境編程:從應用到內核
- Node.js全程實例
- iOS開發實戰:從入門到上架App Store(第2版) (移動開發叢書)
- Deep Learning with R Cookbook
- 寫給大家看的Midjourney設計書
- The Statistics and Calculus with Python Workshop
- Clojure High Performance Programming(Second Edition)
- C# 7.0本質論
- Developing Java Applications with Spring and Spring Boot
- 分布式系統架構與開發:技術原理與面試題解析
- 面向物聯網的Android應用開發與實踐
- Java EE 程序設計
- JavaScript前端開發程序設計教程(微課版)