Skip to content

Instantly share code, notes, and snippets.

@davidmerrick
Last active July 29, 2019 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidmerrick/4e0667caac6e94af4a4cfeaebf310756 to your computer and use it in GitHub Desktop.
Save davidmerrick/4e0667caac6e94af4a4cfeaebf310756 to your computer and use it in GitHub Desktop.
Kotlin conversion cheatsheet

Kotlin Conversion Cheatsheet

A cheat sheet to assist in conversion of Java syntax to Kotlin.

CompletableFutures

Convert Java file to Kotlin, then replace the thenApply that gets generated with the correct Kotlin syntax.

Regex:

Search: \.thenApply[^\{]*\{(.*)\}\)

Replace: .thenApply {$1}

Tests

Replace assertEquals with shouldBe:

Regex:

Search: assertEquals\(([^,]*),[\s]*(.*)\)$

Replace: $1 shouldBe $2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment