Update from Forestry.io

Harsh Shandilya updated content/posts/teachingkotlin-part-3--caveats-coming-from-java.md
This commit is contained in:
Harsh Shandilya 2019-12-05 17:32:13 +00:00 committed by Forestry.io
parent 1e9e3f09d0
commit 65580ff23e
1 changed files with 1 additions and 2 deletions

View File

@ -14,5 +14,4 @@ When you start migrating your Java code to Kotlin, you will encounter multiple s
Java's `java.lang.String#split` [method](https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#split-java.lang.String-) takes a `String` as it's first argument and creates a `Regex` out of it before attempting to split. Kotlin, however, has two variants of this method. One takes a `String` and uses it as a plaintext delimiter, and the other takes a `Regex` behaving like the Java method we mentioned earlier. Code that was directly converted from Java to Kotlin will fail to accommodate this difference, so be on the lookout.
<blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr"><a href="https://twitter.com/hashtag/ProTip?src=hash&ref_src=twsrc%5Etfw">#ProTip</a>: When converting your Java code to <a href="https://twitter.com/hashtag/Kotlin?src=hash&ref_src=twsrc%5Etfw">#Kotlin</a>, remember to double check if you were relying on java.lang.String's implicit Regex conversion, because Kotlin does not do it.<a href="https://t.co/u5DnDRJdx6">pic.twitter.com/u5DnDRJdx6</a></p>— Harsh Shandilya (@MSF_Jarvis) <a href="https://twitter.com/MSF_Jarvis/status/1202077283579826176?ref_src=twsrc%5Etfw">December 4, 2019</a></blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
{{< tweet 1202077283579826176 >}}