Created
June 6, 2016 17:41
-
-
Save arosenb2/3dbbe7d7da9e131177dd326328ae6682 to your computer and use it in GitHub Desktop.
Proving [0] is actually safer than .first() on lists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def list = [].toList() | |
println "List: $list" // [] | |
println "[0]: ${list[0]}" // Null | |
println ".first(): ${list.first()}" // Throws |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment