- Kotlin Standard Library Cookbook
- Samuel Urbanowicz
- 73字
- 2021-07-23 19:05:55
There's more...
Apart from extension functions, Kotlin also offers an extension properties feature. For example, we can declare a property for the List<T> class that will hold information about the last element index value:
val <T> List<T>.lastIndex: Int get() = size - 1
Extensions are a widely used pattern across Kotlin standard library classes. They work seamlessly with Java, Kotlin, JavaScript, and native classes defined within the project and in external dependencies as well.
推薦閱讀
- The Complete Rust Programming Reference Guide
- 零基礎(chǔ)學(xué)Visual C++第3版
- Raspberry Pi Networking Cookbook(Second Edition)
- Rust Cookbook
- Data Analysis with IBM SPSS Statistics
- UML+OOPC嵌入式C語(yǔ)言開(kāi)發(fā)精講
- GameMaker Programming By Example
- Python機(jī)器學(xué)習(xí)基礎(chǔ)教程
- 大模型RAG實(shí)戰(zhàn):RAG原理、應(yīng)用與系統(tǒng)構(gòu)建
- RISC-V體系結(jié)構(gòu)編程與實(shí)踐(第2版)
- C語(yǔ)言程序設(shè)計(jì)實(shí)驗(yàn)指導(dǎo) (第2版)
- 微信小程序開(kāi)發(fā)與實(shí)戰(zhàn)(微課版)
- Test-Driven Machine Learning
- Android驅(qū)動(dòng)開(kāi)發(fā)權(quán)威指南
- Spring Boot+MVC實(shí)戰(zhàn)指南