Menu
In this guide, we’ll take a look at how Kotlin’s null-safety features can be used to replace Java 8’s Optional class. What should you do? Should you leave them as Optional, or change them to more idiomatic Kotlin? When Java 8 introduced Streams for operating on collections of data, it also introduced a similar concept, Optional, which has many methods that are similar to Stream, but operates on a single value that might or might not be present.Īs you migrate your projects from Java to Kotlin, you might come across some Optional objects.
0 Comments
Leave a Reply. |