NEW! Third Edition
Programmer's Guide To Kotlin (2nd Printing)
Buy from:
USA and World Amazon.com
Canada Amazon.ca
UK Amazon.co.uk
France Amazon.fr
Germany Amazon.de
Spain Amazon.es
Italy Amazon.itIndia Amazon.in
-
Paperback: 194 pages
-
Publisher: I/O Press; 1 edition (September 7, 2017) 2nd Printing (July 2018)
-
Language: English
-
ISBN-10: 1871962536
-
ISBN-13: 978-1871962536
-
Product Dimensions: 7.5 x 0.4 x 9.2 inches
This book introduces Kotlin to programmers. You don't have to be an expert Java programmer or expert in any other language, but you need to know the basics of programming and using objects. While Kotlin is similar to Java and you can pick up much of the language as you go along, a deeper understanding will enable you to create better and more robust programs. As with all languages there are some subtle areas where an understanding of how things work makes all the difference.
Contents
- What makes Kotlin Special
- The Basics: Variables, Primitive Types and Functions
- Control
- Strings and Arrays
- The Class & The Object
- Inheritance
- The Type Hierarchy
- Generics
- Collections, Iterators, Sequences & Ranges
- Advanced functions
- Anonymous, Lamdas & Inline Functions
- Data classes, enums and destructuring
- Exceptions, Annotations & Reflection
- Working with Java
About the Author
Mike James is editor of I-Programmer.info, an online magazine written by programmers for programmers. He has a BSc in Physics, an MSc in Mathematics and a PhD in Computer Science. His programming career spans several generations of computer technology but he keeps his skills completely up to date. As an author he has published dozens of books and hundreds of print articles, a tradition he now continues online
Errata: All Corrected in The Current Printing.
Page 22
fun sum(a: int, b: Int=1): Int{
change first i to I.
Page 25
var myObject; MyClassA => var myObject = MyClassA()
Page 48
Int b=a[0] => var b:Int=a[0]
Int b=a.get(0) =>var b:Int=a.get(0)
Page 49
var b?:Int=0 => var b:Int?=0
Page 100
fun add(T,T):T{
return T+T
}
=>
fun add(x:T,y:T):T{
return x+y
}
page 102
MyClassA>MyClassB
implies:MyFunction1(return MyClassA)>MyFunction2(return MyClassB)
should be
MyClassA>MyClassB
implies:MyFunction2(return MyClassA)>MyFunction1(return MyClassB)
i.e. exchange 1 and 2.
page 119
class DateRangeIterator(val start: Date, val endInclusive:Date,val stepDays:Long=1):Iterator{
=>
class DateRangeIterator(val start: Date,
val endInclusive: Date): Iterator {
current.setTime(current.getTime()+stepDays*24*60*60*1000)
=>
current.setTime(current.getTime())
Page 160
prop, old, new -> println("new")
=> prop, old, new -> println(new)