Skip to content

Instantly share code, notes, and snippets.

@fabiomsr
Last active August 1, 2016 11:56
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 fabiomsr/ae3476fb2e3fd9ccb188bc2a80886330 to your computer and use it in GitHub Desktop.
Save fabiomsr/ae3476fb2e3fd9ccb188bc2a80886330 to your computer and use it in GitHub Desktop.
// Java
if(text != null){
int length = text.length();
}
// Kotlin
// Text = String?
val length = text!!.length // NullPointerException if text == null
// Kotlin
// Text = String?
val length = text?.length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment