NEW! Second 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.it

India 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

  1. What makes Kotlin Special
  2. The Basics: Variables, Primitive Types and Functions
  3. Control
  4. Strings and Arrays
  5. The Class & The Object
  6. Inheritance
  7. The Type Hierarchy
  8. Generics
  9. Collections, Iterators, Sequences & Ranges
  10. Advanced functions
  11. Anonymous, Lamdas & Inline Functions
  12. Data classes, enums and destructuring
  13. Exceptions, Annotations & Reflection
  14. 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)