My adoption of Kotlin is purely as a language targeting the Android platform so I have very little experience developing with Java and the JVM (I am primarily a C# developer). I started writing a quick guide to Kotlin two weekends ago just to exercise my knowledge of the language and I am surprised to discover that I am using most of the language features on my daily Android development (including all the myriad features related to functions).
Features that I haven’t used in my projects are local class (defining a class inside a function), delegated class, and the brand new delegated properties.
public fun googleShorten(url: String): Result<String>
{
class shortenData (public val longUrl: String)
class shortenDataReply(public val kind: String, public val id: String, public longUrl: String)
try
{
val gson = Gson()
val payload = gson.toJson(shortenData(url))
var pst = HttpRequest.post(“https://www.googleapis.com/urlshortener/v1/url”)
pst?.contentType(“application/json”)
pst?.send(payload)