Elvis operator

It can be used when developers expect to return a default value when the reference is null:

val hash:TrackedHashTag? = TrackedHashTag(hashTag="java",queue="java")val queueString = hash?.queue ?: "unrecognized-queue"

When the value holds null, the default value will be returned.

Time to use Kotlin in the real world. Let's begin.

Get Spring 5.0 By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.