This is a course on the Kotlin programming language. Kotlin is a programming language made by JetBrains which targets the JVM. Kotlin is designed to be a better Java. It is more concise, safer, has better support for functional programming and is designed to speed up everyday development tasks. Kotlin also has great tool support, since it's made by the makers of IntelliJ IDEA, the world leading IDE.
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:
This is a course on the Kotlin programming language. Kotlin is a programming language made by JetBrains which targets the JVM. Kotlin is designed to be a better Java. It is more concise, safer, has better support for functional programming and is designed to speed up everyday development tasks. Kotlin also has great tool support, since it's made by the makers of IntelliJ IDEA, the world leading IDE.
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:
How to install and run Kotlin and why toolability matters (I use IntelliJ)
Type inference and how it can save you a lot of time
Smart control flow structures that let you write more succinctly
Mutability options (val and var), what they mean and how to use them
Nullability guarantees and how they make your code more safe
The power of functional literals (nested functions and lambdas)
Powerful built-in delegation functionality
How to leverage Kotlin's collection operations to process data sets efficiently
...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.
Update: Google has just announced official support for Kotlin on Android. Congratulations to the Kotlin team.
A brief overview of why Kotlin is so good.
A little note about the options available for downloading and installing Kotlin.
Let's set up the IDE and run our first Kotlin program.
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.
A discussion of Kotlin collection support and why it rocks.
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.
Yeah, Java has reflection too, but can you tell if your object is a singleton or a companion object? Of course not. Kotlin reflection to the rescue!
Learn to work with references to functions. Remember, functions are everywhere in kotlin. Got a property? Well, its getters/setters are functions. Also you get to see how to handle references to function overloads.
Learn to work with property references. Remember, typical val/var declarations are properties too!
Learn to work with references to class constructors.
Function and property references can also bind itself to an instance of the receiver.
Type aliases provide alternative names for existing types.
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.
OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.
Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.
Find this site helpful? Tell a friend about us.
We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.
Your purchases help us maintain our catalog and keep our servers humming without ads.
Thank you for supporting OpenCourser.