首页 文章 精选 留言 我的

精选列表

搜索[博客],共10001篇文章
优秀的个人博客,低调大师

博客大赛】浅析go切片与排序

切片是Go语言中引入的用于在大多数场合替代数组的语法元素。切片是一种长度可变的同类型元素序列,它原则上不支持存储不同类型的元素,当然了作为打工人是非常清楚“原则上”的潜台词就是“某种情况下允许” special := []interface{}{“hello go”, 2021, 4.15} 这种允许的情况有机会我们另外讨论,这个不是本次的讨论范围,本文就事论事,还不至于深入到原理。 正所谓有序列的地方就有排序的需求。在各种排序算法都已经成熟的今天,我们完全可以针对特定元素类型的切片手写排序函数/方法,但多数情况下不推荐这么做,因为Go标准库内置了sort包可以很好地帮助我们实现原生类型元素切片以及自定义类型元素切片的排序任务,但话又说回来,工程项目中我们大概率都是拿来主义的,也只有是在平常刷题练习中才会自己考虑实现相关的算法。 对于sort Go 的排序思路和 C 和 C++ 有些差别。 C 默认是对数组进行排序, C++ 是对一个序列进行排序, Go 则更宽泛一些,待排序的可以是任何对象, 虽然很多情况下是一个slice (分片, 类似于数组),或是包含 slice 的一个对象。 这个包实现了四种基本排序算法:插入排序、归并排序、堆排序和快速排序。但是这四种排序方法是不公开的,它们只被用于sort 包内部使用。因此在对数据集合排序时不必考虑应当选择哪一种排序方法,只要实现了 sort.Interface 定义的三个方法: 获取数据集合长度的Len() 方法 比较两个元素大小的Less() 方法 交换两个元素位置的Swap()方法 完成之后可以顺利对数据集合进行排序【无时不刻在等待泛型的出现啊,重复写真的烦:)】 sort 包会根据实际数据自动选择高效的排序算法。 除此之外,为了方便对常用数据类型的操作,sort 包提供了对[]int切片、[]float64 切片和[]string 切片完整支持,主要包括: 对基本数据类型切片的排序支持 基本数据元素查找 判断基本数据类型切片是否已经排好序 对排好序的数据集合逆序 数据集合排序 前面已经提到过,对数据集合(包括自定义数据类型的集合)排序需要实现 sort.Interface 接口的三个方法,我们看以下该接口的定义: type Interface interface { // 获取数据集合元素个数 Len() int // 如果 i 索引的数据小于 j 索引的数据,返回 true,且不会调用下面的 Swap(),即数据升序排序。 Less(i, j int) bool // 交换 i 和 j 索引的两个元素的位置 Swap(i, j int) } 数据集合实现了这三个方法后,即可调用该包的Sort() 方法进行排序。Sort() 方法定义如下: func Sort(data Interface) Sort() 方法使用的惟一参数就是待排序的数据集合。 此外该包还提供了一个方法可以判断数据集合是否已经排好顺序,毕竟方法的内部实现依赖于我们自己实现的 Len() 和 Less() 方法: func IsSorted(data Interface) bool { n := data.Len() for i := n - 1; i > 0; i-- { if data.Less(i, i-1) { return false } } return true } 最后一个方法:Search() func Search(n int, f func(int) bool) int 该方法会使用“二分查找”算法来找出能使f(x)(0&lt;=x&lt;n) 返回 ture 的最小值 i。 前提条件 : f(x)(0&lt;=x&lt;i) 均返回false,f(x)(i&lt;=x&lt;n) 均返回ture。 如果不存在 i 可以使 f(i) 返回 ture, 则返回 n。 Search() 函数一个常用的使用方式是搜索元素 x 是否在已经升序排好的切片 s 中: x := 11 s := []int{3, 6, 8, 11, 45} // 注意已经升序排序 pos := sort.Search(len(s), func(i int) bool { return s[i] >= x }) if pos < len(s) && s[pos] == x { fmt.Println(x, " 在 s 中的位置为:", pos) } else { fmt.Println("s 不包含元素 ", x) } 排序原理 截至目前Go 1.15版本,Go还不支持泛型。因此,为了支持任意元素类型的切片的排序,标准库sort包定义了一个Interface接口和一个接受该接口类型参数的Sort函数: type Interface interface { Len() int Less(i, j int) bool Swap(i, j int) } func Sort(data Interface) { n := data.Len() quickSort(data, 0, n, maxDepth(n)) } 为了应用这个排序函数Sort,我们需要让被排序的切片类型实现sort.Interface接口,以整型切片为例 type IntSlice []int func (p IntSlice) Len() int { return len(p) } func (p IntSlice) Less(i, j int) bool { return p[i] < p[j] } func (p IntSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } func main() { sl := IntSlice([]int{89, 14, 8, 9, 17, 56, 95, 3}) fmt.Println(sl) // [89 14 8 9 17 56 95 3] sort.Sort(sl) fmt.Println(sl) // [3 8 9 14 17 56 89 95] } 从sort.Sort函数的实现来看,它使用的是快速排序quickSort。我们知道快速排序是在所有数量级为O(nlogn)的排序算法中其平均性能最好的算法,但在某些情况下其性能却并非最佳,Go sort包中的quickSort函数也没有严格拘泥于仅使用快排算法,而是以快速排序为主,并根据目标状况在特殊条件下选择了其他不同的排序算法,包括堆排序(heapSort)、插入排序(insertionSort)等。 sort.Sort函数不保证排序是稳定的,要想使用稳定排序,需要使用sort.Stable函数。 sort包的“语法糖”排序函数 我们看到,直接使用sort.Sort函数对切片进行排序是比较繁琐的。如果仅仅排序一个原生的整型切片都这么繁琐(要实现三个方法),那么sort包是会被喷惨的。还好,对于以常见原生类型为元素的切片,sort包提供了类“语法糖”的简化函数,比如:sort.Ints、sort.Float64s和sort.Strings等。上述整型切片的排序代码可以直接改造成下面这个样子: func main() { sl := []int{89, 14, 8, 9, 17, 56, 95, 3} fmt.Println(sl) // [89 14 8 9 17 56 95 3] sort.Ints(sl) fmt.Println(sl) // [3 8 9 14 17 56 89 95] } 原生类型有“语法糖”可用了,那么对于自定义类型作为元素的切片,是不是每次都得实现Interface接口的三个方法呢?Go团队也想到了这个问题! 所以在Go 1.8版本中加入了sort.Slice函数,我们只需传入一个比较函数实现即可: type Lang struct { Name string Rank int } func main() { langs := []Lang{ {"rust", 2}, {"go", 1}, {"swift", 3}, } sort.Slice(langs, func(i, j int) bool { return langs[i].Rank < langs[j].Rank }) fmt.Printf("%v\n", langs) // [{go 1} {rust 2} {swift 3}] } 同理,如果要进行稳定排序,则用sort.SliceStable替换上面的sort.Slice。 总结 本文主要是通过对go中切片的分析,由于go中的排序不同于c、c++、python这些语言的排序习惯,又由于其不支持泛型,且正处于野蛮生长期,我们在学习应用的过程中,也难得的可以体验其发育带来痛苦,正因为没有体会相同的痛苦,就不能感同身受,成熟的语言如java、python用多了,一直用别人的轮子,实在体会不到轮子内部的精妙之处,我们在学习的过程中可以自己实现相关的排序算法,见证社区的发展,反而可以一步步推演内核的进化,进而触类旁通猜测其他语言的设计思想,不胜荣幸。 参考资料 https://books.studygolang.com/The-Golang-Standard-Library-by-Example/chapter03/03.1.html https://golang.org/pkg/sort/ https://tonybai.com/2020/11/26/slice-sort-in-go/ https://itimetraveler.github.io/2016/09/07/%E3%80%90Go%E8%AF%AD%E8%A8%80%E3%80%91%E5%9F%BA%E6%9C%AC%E7%B1%BB%E5%9E%8B%E6%8E%92%E5%BA%8F%E5%92%8C%20slice%20%E6%8E%92%E5%BA%8F/

优秀的个人博客,低调大师

Hexo Fluid 博客主题更新 1.8.9 版本

主要更新内容 重构懒加载代码 FrontMatter 可以设置keywords参数 增加分类文章排序字段 增加评论插件配置字段 关于 Fluid Fluid 是一款基于 Hexo 框架的 Material Design 风格主题。 该主题相较于其他主题的优势: 1. 优雅的颜值,使用 Material Design 风格突出层次感,但又不失简约,让用户能专注于写作; 2. 提供大量定制化配置项,使每个用户使用该主题都能具有独特的样式; 3. 响应式页面,适配手机、平板等设备,包括极端的分辨率都能轻松应对; 4. 主题中少有的整合了 LaTeX 和 mermaid 的支持 目前具有的功能特性: 图片懒加载 自定义代码高亮方案 内置多语言 支持多款评论插件 支持使用数据文件存放配置 自定义静态资源 CDN 无比详实的用户文档 内置文章搜索 页脚备案信息 网页访问统计 支持脚注语法 支持 LaTeX 数学公式 支持 mermaid 流程图 暗色模式 详情查看:https://github.com/fluid-dev/hexo-theme-fluid

优秀的个人博客,低调大师

Hexo Fluid 博客主题更新 1.8.8 版本

主要更新内容 自定义页与关于页支持评论 友链页支持自定义区域和评论 友链页增加默认头像 多语言增加繁体中文 优化一些样式 关于 Fluid Fluid 是一款基于 Hexo 框架的 Material Design 风格主题。 该主题相较于其他主题的优势: 1. 优雅的颜值,使用 Material Design 风格突出层次感,但又不失简约,让用户能专注于写作; 2. 提供大量定制化配置项,使每个用户使用该主题都能具有独特的样式; 3. 响应式页面,适配手机、平板等设备,包括极端的分辨率都能轻松应对; 4. 主题中少有的整合了 LaTeX 和 mermaid 的支持 目前具有的功能特性: 图片懒加载 自定义代码高亮方案 内置多语言 支持多款评论插件 支持使用数据文件存放配置 自定义静态资源 CDN 无比详实的用户文档 内置文章搜索 页脚备案信息 网页访问统计 支持脚注语法 支持 LaTeX 数学公式 支持 mermaid 流程图 暗色模式 详情查看:https://github.com/fluid-dev/hexo-theme-fluid/releases/tag/v1.8.8

优秀的个人博客,低调大师

Hexo Fluid 博客主题更新 1.8.7 版本

主要更新内容 全新的文章便签配色 限制 TOC 的最大高度(超出可以滚动) 优化移动端下显示样式 进度条关联图片加载 关于 Fluid Fluid 是一款基于 Hexo 框架的 Material Design 风格主题。 该主题相较于其他主题的优势: 1. 优雅的颜值,使用 Material Design 风格突出层次感,但又不失简约,让用户能专注于写作; 2. 提供大量定制化配置项,使每个用户使用该主题都能具有独特的样式; 3. 响应式页面,适配手机、平板等设备,包括极端的分辨率都能轻松应对; 4. 主题中少有的整合了 LaTeX 和 mermaid 的支持 目前具有的功能特性: 图片懒加载 自定义代码高亮方案 内置多语言 支持多款评论插件 支持使用数据文件存放配置 自定义静态资源 CDN 无比详实的用户文档 内置文章搜索 页脚备案信息 网页访问统计 支持脚注语法 支持 LaTeX 数学公式 支持 mermaid 流程图 暗色模式 详情查看:https://github.com/fluid-dev/hexo-theme-fluid/releases/tag/v1.8.7

优秀的个人博客,低调大师

Hexo Fluid 博客主题更新 1.8.6 版本

主要更新内容 代码可以显示行数 增加Waline评论插件 默认字体族优先使用系统字体 不蒜子和 LeanCloud 统计可以共用 修复上个版本中一些 BUG 关于 Fluid Fluid 是一款基于 Hexo 框架的 Material Design 风格主题。 该主题相较于其他主题的优势: 1. 优雅的颜值,使用 Material Design 风格突出层次感,但又不失简约,让用户能专注于写作; 2. 提供大量定制化配置项,使每个用户使用该主题都能具有独特的样式; 3. 响应式页面,适配手机、平板等设备,包括极端的分辨率都能轻松应对; 4. 主题中少有的整合了 LaTeX 和 mermaid 的支持 目前具有的功能特性: 图片懒加载 自定义代码高亮方案 内置多语言 支持多款评论插件 支持使用数据文件存放配置 自定义静态资源 CDN 无比详实的用户文档 内置文章搜索 页脚备案信息 网页访问统计 支持脚注语法 支持 LaTeX 数学公式 支持 mermaid 流程图 暗色模式

优秀的个人博客,低调大师

Hexo Fluid 博客主题更新 1.8.3 版本

主要更新内容 增加对 prismjs 高亮库的支持 增加 remark42 评论插件 文章页支持显示作者 修复新版 Chrome 导致滚动闪屏 关于 Fluid Fluid 是一款基于 Hexo 框架的 Material Design 风格主题。 该主题相较于其他主题的优势: 1. 优雅的颜值,使用 Material Design 风格突出层次感,但又不失简约,让用户能专注于写作; 2. 提供大量定制化配置项,使每个用户使用该主题都能具有独特的样式; 3. 响应式页面,适配手机、平板等设备,包括极端的分辨率都能轻松应对; 4. 主题中少有的整合了 LaTeX 和 mermaid 的支持 目前具有的功能特性: 图片懒加载 自定义代码高亮方案 内置多语言 支持多款评论插件 支持使用数据文件存放配置 自定义静态资源 CDN 无比详实的用户文档 内置文章搜索 页脚备案信息 网页访问统计 支持脚注语法 支持 LaTeX 数学公式 支持 mermaid 流程图 音乐播放器 暗色模式

优秀的个人博客,低调大师

Hexo Fluid 博客主题更新 1.8.2 版本

主要更新内容 暗色主题模式 更多 Web 语义化 修复评论插件的BUG 关于 Fluid Fluid 是一款基于 Hexo 框架的 Material Design 风格主题。 该主题相较于其他主题的优势: 1. 优雅的颜值,使用 Material Design 风格突出层次感,但又不失简约,让用户能专注于写作; 2. 提供大量定制化配置项,使每个用户使用该主题都能具有独特的样式; 3. 响应式页面,适配手机、平板等设备,包括极端的分辨率都能轻松应对; 4. 主题中少有的整合了 LaTeX 和 mermaid 的支持 目前具有的功能特性: 图片懒加载 自定义代码高亮方案 内置多语言 支持多款评论插件 支持使用数据文件存放配置 自定义静态资源 CDN 无比详实的用户文档 内置文章搜索 页脚备案信息 网页访问统计 支持脚注语法 支持 LaTeX 数学公式 支持 mermaid 流程图 音乐播放器

优秀的个人博客,低调大师

Hexo Fluid 博客主题更新 1.8.1 版本

主要更新内容 导航栏增加二级菜单功能 加入 LeanCloud 用于统计访问数据 支持 Markdown 脚注语法 重写了分类页(category)的页面样式 懒加载采用新机制,大幅提高性能 优化多处样式细节 关于 Fluid Fluid 是一款基于 Hexo 框架的 Material Design 风格主题。 该主题相较于其他主题的优势: 1. 优雅的颜值,使用 Material Design 风格突出层次感,但又不失简约,让用户能专注于写作; 2. 提供大量定制化配置项,使每个用户使用该主题都能具有独特的样式; 3. 响应式页面,适配手机、平板等设备,包括极端的分辨率都能轻松应对; 4. 主题中少有的整合了 LaTeX 和 mermaid 的支持 目前具有的功能特性: 图片懒加载 自定义代码高亮方案 内置多语言 支持多款评论插件 支持使用数据文件存放配置 自定义静态资源 CDN 无比详实的用户文档 内置文章搜索 页脚备案信息 网页访问统计 支持脚注语法 支持 LaTeX 数学公式 支持 mermaid 流程图 音乐播放器

优秀的个人博客,低调大师

Hexo 博客主题 Fluid 发布 1.8.0 版本

主要更新内容 增加多款内置 Tag 功能 顶部菜单支持自定义图标 支持 mermaid 代码渲染 懒加载可在自定义页面单独开启 主题新版本自动检测 增加大量配置项 关于 Fluid Fluid 是一款基于 Hexo 框架的 Material Design 风格主题。 该主题相较于其他主题的优势: 1. 优雅的颜值,使用 Material Design 风格突出层次感,但又不失简约,让用户能专注于写作; 2. 提供大量定制化配置项,使每个用户使用该主题都能具有独特的样式; 3. 响应式页面,适配手机、平板等设备,包括极端的分辨率都能轻松应对; 4. 主题中少有的整合了 LaTeX 和 mermaid 的支持 目前具有的功能特性: 图片懒加载 自定义代码高亮方案 内置多语言 支持多款评论插件 支持使用数据文件存放配置 自定义静态资源 CDN 无比详实的用户文档 内置文章搜索 页脚备案信息 网页访问统计 支持 LaTeX 数学公式 支持 mermaid 流程图 音乐播放器 相关链接 GitHub: https://github.com/fluid-dev/hexo-theme-fluid Preview: https://hexo.fluid-dev.com/

优秀的个人博客,低调大师

[雪峰磁针石博客]性能测试艺术

为什么要进行性能测试? 什么是好的与坏的性能?为什么性能测试在软件开发生命周期(SDLC software development life cycle)中很重要? 性能不佳的应用通常无法实现企业预期利益,花费了大量时间和金钱,但是却在用户中失去了信誉。 相比功能测试和验收测试(OAT operational acceptance testing),性能测试容易被忽略,往往在发布之后碰到性能和扩展性问题才意识到重要性。 最终用户眼中的性能 性能”是用户最终的感受。性能优异的应用在最终用户执行某项任务时不会产生过度的延迟而引起用户的不满。好的应用不会在登录时显示空屏,不会让用户走神。比如偶然的用户在购物网站上寻找和购买他们所需要的东西时,客户中心不会收到差性能的投诉。 多 数应用系统在峰值时性能表现不佳。从高层看,应用由客户端软件和基础设施组成

优秀的个人博客,低调大师

[雪峰磁针石博客]kotlin书籍汇总

下载地址 Learning Kotlin by Building Android Applications - 2018 初级 Develop amazing applications that will help you understand and explore the fundamentals of Kotlin while covering 3 various types of projects Key Features Explore the fundamentals of Kotlin by building effective Android applications. Develop and test Android applications using only the Kotlin language. One of the major (and best) Android features, Kotlin provides deep interoperability with Java. Book Description Google has extended support to the widely adopted, and powerful, Kotlin programming language. It works in parallel with Java and C++, which makes it easier (even for existing developers) to learn a new language for their most favored platform. This book adopts a project-style approach, where we focus on teaching Android development by building three different Android Applications. The book begins by giving you a strong grasp of the Kotlin language and its APIs as a preliminary to building stunning applications for Android. You'll learn to set up an environment as the difficulty level grows steadily, in line with applications covered in later chapters. The book also introduces you to the Android Studio IDE, which plays an integral role in Kotlin Android Development. It covers Kotlin's basic programming concepts such as functions, lambdas, properties, object-oriented code, safety aspects and type parameterization, testing, and concurrency, and helps you write Kotlin code to production. Finally, you'll be taken through the process of releasing your app on the Google Play Store. You will also be introduced to other app distribution channels such as Amazon and App Store. As a bonus chapter you will also learn how to use the Google Faces API to detect faces and add fun functionalities. What you will learn Learn the basics of using the Android Studio IDE and a number of basic programming concepts in Kotlin Discover Android development by building Android apps with Kotlin Uncover some amazing features of Kotlin that give it the upper hand over Java Kotlin Interoperability with Java Integrate Crashlytics for crash reporting and beta testing. Automate your build process with continuous integration tools. Learn to release and publish your app in various distribution channels. Who This Book Is For If you are completely new to Kotlin or the Android platform and need to publish Android applications for fun or for business purposes, but you have no clue where to start, then this book is for you. This book is also for advanced Android developers who want to learn to use Kotlin instead of/alongside Java for Android development. About the Author Eunice Adutwumwaa Obugyei is an author on Raywenderlich. Eunice is a software engineer at DreamOval, currently focusing on Mobile development. Natarajan Raman has close to 15 years' of experience in software design and development. He is a Google certified Nano degree holder on Android development and was invited as a guest by Google for the I/O 2017. His Android App Idea for special children got selected as one of the top SIX ideas out of 80 odd ideas and was also featured by Google on Code it possible program. He works for Patterns and is also the managing trustee of Dream India. kotlin programming by example - 2018 初级 Enhance your Kotlin programming skills by building 3 real-world applications Key Features Build three full-fledged, engaging applications from scratch and learn to deploy them Enhance your app development and programming activities with Kotlin’s powerful and intuitive tools and utilities. Experience the gentle learning curve, expressiveness, and intuitiveness of Kotlin, as you develop your own applications Book Description Kotlin greatly reduces the verbosity of source code. With Google having announced their support for Kotlin as a first-class language for writing Android apps, now's the time learn how to create apps from scratch with Kotlin Kotlin Programming By Example takes you through the building blocks of Kotlin, such as functions and classes. You’ll explore various features of Kotlin by building three applications of varying complexity. For a quick start to Android development, we look at building a classic game, Tetris, and elaborate on object-oriented programming in Kotlin. Our next application will be a messenger app, a level up in terms of complexity. Before moving onto the third app, we take a look at data persistent methods, helping us learn about the storage and retrieval of useful applications. Our final app is a place reviewer: a web application that will make use of the Google Maps API and Place Picker. By the end of this book, you will have gained experience of of creating and deploying Android applications using Kotlin. What you will learn Learn the building blocks of the Kotlin programming language Develop powerful RESTful microservices for Android applications Create reactive Android applications efficiently Implement an MVC architecture pattern and dependency management using Kotlin Centralize, transform, and stash data with Logstash Secure applications using Spring Security Deploy Kotlin microservices to AWS and Android applications to the Play Store Who this book is for This book is for those who are new to Kotlin or are familiar with the basics, having dabbled with Java until now. Basic programming knowledge is mandatory. Table of Contents The Fundamentals Building an Android Application-Tetris Implementing Tetris Logic and Functionality Designing and Implementing the Messenger Backend with Spring Boot 2.0 Building the Messenger Android App - Part 1 Building the Messenger Android App - Part 2 Storing Information in a Database Securing and Deploying the Android app Creating the Place Reviewer Backend with Spring Implementing the Place Reviewer Frontend Kotlin Blueprints - 2017 中级 Get to know the building blocks of Kotlin and best practices when using quality world-class applications Key Features Learn to build exciting and scalable Android and web applications (both the server-side and client-side parts) with your Kotlin skills Dive into the great ecosystem of Kotlin frameworks and libraries through projects that you'll build using this book This project-based guide contains clear instructions to help you extend your applications across a wide domain Book Description Kotlin is a powerful language that has applications in a wide variety of fields. It is a concise, safe, interoperable, and tool-friendly language. The Android team has also announced first-class support for Kotlin, which is an added boost to the language. Kotlin's growth is fueled through carefully designed business and technology benefits. The collection of projects demonstrates the versatility of the language and enables you to build standalone applications on your own. You'll build comprehensive applications using the various features of Kotlin. Scale, performance, and high availability lie at the heart of the projects, and the lessons learned throughout this book. You'll learn how to build a social media aggregator app that will help you efficiently track various feeds, develop a geospatial webservice with Kotlin and Spring Boot, build responsive web applications with Kotlin, build a REST API for a news feed reader, and build a server-side chat application with Kotlin. It also covers the various libraries and frameworks used in the projects. Through the course of building applications, you'll not only get to grips with the various features of Kotlin, but you'll also discover how to design and prototype professional-grade applications. What you will learn See how Kotlin's power and versatility make it a great choice to create applications across various platforms, and how it delivers business and technology benefits Write a robust web applications using Kotlin with Spring Boot Write Android applications with ease using Kotlin Write rich desktop applications in Kotlin Learn how Kotlin can generate Javascript and how this can be used on client side and server side development Understand how native applications can be written with Kotlin/Native Learn the practical aspects of programming in each of the applications Who This Book Is For This practical guide is for programmers who are already familiar with Kotlin. If you are familiar with Kotlin and want to put your knowledge to work, then this is the book for you. Kotlin programming knowledge is a must. Table of Contents The Power of Kotlin Geospatial Messenger Social Media Aggregator Android App Weather App Using Kotlin for JavaScript Chat Application with Server-side JavaScript Generation News Feed - REST API CSV Reader in Kotlin Native Dictionary Desktop Application - Tornado FX Kotlin in Action - 2017 中级 Summary Kotlin in Action guides experienced Java developers from the language basics of Kotlin all the way through building applications to run on the JVM and Android devices. Foreword by Andrey Breslav, Lead Designer of Kotlin. Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications. About the Technology Developers want to get work done - and the less hassle, the better. Coding with Kotlin means less hassle. The Kotlin programming language offers an expressive syntax, a strong intuitive type system, and great tooling support along with seamless interoperability with existing Java code, libraries, and frameworks. Kotlin can be compiled to Java bytecode, so you can use it everywhere Java is used, including Android. And with an effi cient compiler and a small standard library, Kotlin imposes virtually no runtime overhead. About the Book Kotlin in Action teaches you to use the Kotlin language for production-quality applications. Written for experienced Java developers, this example-rich book goes further than most language books, covering interesting topics like building DSLs with natural language syntax. The authors are core Kotlin developers, so you can trust that even the gnarly details are dead accurate. What's Inside Functional programming on the JVM Writing clean and idiomatic code Combining Kotlin and Java Domain-specific languages About the Reader This book is for experienced Java developers. About the Author Dmitry Jemerov and Svetlana Isakova are core Kotlin developers at JetBrains. Table of Contents PART 1 - INTRODUCING KOTLIN PART 2 - EMBRACING KOTLIN Kotlin: what and why Kotlin basics Defining and calling functions Classes, objects, and interfaces Programming with lambdas The Kotlin type system Operator overloading and other conventions Higher-order functions: lambdas as parameters and return values Generics Annotations and reflection DSL construction Kotlin Programming Cookbook - 2018 中级 Discover Android programming and web development by understanding the concepts of Kotlin Programming Key Features Practical solutions to your common programming problems with Kotlin 1.1 Leverage the functional power of Kotlin to ease your Android application development Learn to use Java code in conjunction with Kotlin Book Description The Android team has announced first-class support for Kotlin 1.1. This acts as an added boost to the language and more and more developers are now looking at Kotlin for their application development. This recipe-based book will be your guide to learning the Kotlin programming language. The recipes in this book build from simple language concepts to more complex applications of the language. After the fundamentals of the language, you will learn how to apply the object-oriented programming features of Kotlin 1.1. Programming with Lambdas will show you how to use the functional power of Kotlin. This book has recipes that will get you started with Android programming with Kotlin 1.1, providing quick solutions to common problems encountered during Android app development. You will also be taken through recipes that will teach you microservice and concurrent programming with Kotlin. Going forward, you will learn to test and secure your applications with Kotlin. Finally, this book supplies recipes that will help you migrate your Java code to Kotlin and will help ensure that it's interoperable with Java. What you will learn Understand the basics and object-oriented concepts of Kotlin Programming Explore the full potential of collection frameworks in Kotlin Work with SQLite databases in Android, make network calls, and fetch data over a network Use Kotlin's Anko library for efficient and quick Android development Uncover some of the best features of Kotlin: Lambdas and Delegates Set up web service development environments, write servlets, and build RESTful services with Kotlin Learn how to write unit tests, integration tests, and instrumentation/acceptance tests. Who this book is for This book will appeal to Kotlin developers keen to find solutions for their common programming problems. Java programming knowledge would be an added advantage. Table of Contents Installation and working with Environment Control flow Classes and Objects Functions Object oriented programming Collections Framework Handling File operations in Kotlin Anko Commons and Extension function Anko Layouts Databases and Dependency Injection Networking and Concurrency Lambdas and Delegates Testing Web services with Kotlin Kotlin Standard Library Cookbook - 2018 中级 Build optimized applications in Kotlin by learning how to make use of the standard library features the smart way. Book Description Given the verbosity of Java, developers have turned to Kotlin for effective software development. The Kotlin standard library provides vital tools that make day-to-day Kotlin programming easier. This library features the core attributes of the language, such as algorithmic problems, design patterns, data processing, and working with files and data streams The recipes in this book offer coding solutions that can be readily executed. The book covers various topics related to data processing, I/O operations, and collections transformation. We'll walk through effective design patterns in Kotlin and you'll understand how coroutines add new features to JavaScript. As you make your way through the chapters, you'll learn how to implement clean, reusable functions and scalable interfaces containing default implementations. In the concluding chapters, we'll provide recipes on functional programming concepts, such as lambdas, monads, functors, and Kotlin scoping functions. By the end of the book, you'll be able to address a range of problems that Kotlin developers face by implementing easy-to-follow solutions. What You Will Learn Work with ranges, progressions, and sequences in use cases Add new functionalities to current classes with Kotlin extensions Understand elements such as lambdas, closures, and monads Build a REST API consumer with Retrofit and a coroutine adapter Discover useful tips and solutions for making your Android projects Explore the benefits of standard library features Authors Samuel Urbanowicz is an experienced software engineer skilled in mobile applications and backend development. A fan of modern programming languages, he has been using Kotlin since its beginning. He's always curious to dive into technologies. He is especially passionate about machine learning. Samuel believes that the Kotlin language has great potential for multiplatform development. He has work experience in both big corps and small start-ups. He is an active contributor to open source projects.

资源下载

更多资源
腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册