This is a course on the Kotlin programming language. This course is designed for people already familiar with Java who are looking for a more modern, expressive and powerful language for the JVM.
In this course, you will learn about:
... and a lot more!
This course is completely live-demo based. All the lectures are examples of real code being edited and executed using the IntelliJ IDEA Community Edition IDE.
Learn about the difference between val and var. Also: there is no new and no semicolons.
Thanks to type deduction, most variable type decorations are not necessary. Woo-hoo!
Ranges of values. Self-explanatory, right?
A look at how arrays are represented and used in Kotlin.
Strings aren't complicated, but interpolation makes them more powerful.
Kotlin provides powerful support for dealing with nullability. Lean everything about ?, ?., ?: and !!
Yer olde if is an expression that can return values and can appear in interpolated strings.
Why should the IDE check if you are risking an NPE, if the compiler can do it just as well? This awesome compiler feature also takes care of type conversions and more.
This ain't your father's for loop!
Kotlin's powerful alternative to Java's switch.
Kotlin has functions which are not inside any class. What is this, C++?!?
Kotlin supports default argument values and calls with named arguments.
Call a function with any number of arguments, comma-separated-like.
Functions within functions.
Explains how functions such as downTo are implemented.
Yay, lambdas! Oh, wait, Java has lambdas too? Yeah, but not like these!
Warning: Kotlin lambdas may or may not be cached when passed into Java event listeners. Be careful!
Functions taking functions, but why?
Define the context of the function's operation. Advanced topic!
Give a class a magic method called invoke and call it like a function (a.k.a. functor).
What, no fields? With Kotlin, forget about fields and getter/setter hell: properties take care of it all!
Give any type additional functionality.
Primary constructors provide an epic level of succinctness. But if you need to do more than initialize some fields, init block to the rescue!
You can override the implementation of a property in an external class. But why?!?
Warning: when you reference this in a delegated property class, you are referring to that class, not the class where the delegated property is going to be used. Be careful!
Simple, yet powerful, data classes auto-implement the basic scaffolding for you. Don't worry, you can override anything you don't like!
Kotlin lets you make Singletons with ease. It doesn't have static functions, but companion objects are a close alternative.
Kotlin doesn't have statics. But you can still get them, in a way.
Learn about the override keyword, base call disambiguation, opening types and more.
Interfaces... can contain properties as well as functions.
The Decorator pattern is essentially built-in in Kotlin.
Let's dig into kotlin-runtime.jar and find all the classes related to collection operations as well as sequences. We'll also learn how to make sequence generators: a useful feature that we'll use throughout this entire section.
Counting how many elements fit a predicate.
Mapping each element to something else.
Compressing a sequence to a single value.
Keeping elements satisfying (or not) a particular predicate and throwing all others away.
Splitting a sequence based on a criterion.
Grouping elements by a particular key.
Sorting a data set by one or more of its properties.
Operations which try to access an individual element of the collection.
Operations on algebraic sets.
A summary of all the collection operations we've discussed in this section of the course.
Yes, enumerations, with abstract functions and whatnot.
Kotlin has no checked exceptions. But try-catch is an expression.
But only standard operators, none of that F#-inspired operator <#%$> magic.
A look at how function types with receivers, together with lambda expressions, can help us make Groovy-style builders.
Dmitri Nesteruk is a developer, speaker and podcaster. His interests lie in software development and integration practices in the areas of computation, quantitative finance and algorithmic trading. His technological interests include C#, F# and C++ programming as well high-performance computing using technologies such as CUDA. He has been a C# MVP since 2009.
Dmitri is a graduate of University of Southampton (B.Sc. Computer Science) where he currently holds a position as a Visiting Researcher. He is also an instructor on an online intro-level Quantitative Finance course, and has also made online video courses on CUDA, MATLAB, D, the Boost libraries and other topics.