- 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
推薦閱讀
- Google Flutter Mobile Development Quick Start Guide
- ASP.NET MVC4框架揭秘
- 深入淺出Electron:原理、工程與實踐
- 技術(shù)領(lǐng)導(dǎo)力:程序員如何才能帶團隊
- Learning AWS Lumberyard Game Development
- Mastering Android Development with Kotlin
- 深入理解Android:Wi-Fi、NFC和GPS卷
- 精通MATLAB(第3版)
- Microsoft Dynamics AX 2012 R3 Financial Management
- MATLAB GUI純代碼編寫從入門到實戰(zhàn)
- Python計算機視覺和自然語言處理
- Learning Jakarta Struts 1.2: a concise and practical tutorial
- Python Penetration Testing Essentials
- Mastering Clojure
- Python深度學(xué)習(xí):基于PyTorch