September 2018
Intermediate to advanced
398 pages
9h 43m
English
An implicit conversion converts a source type to a target type. This allows you to do the following:
For instance, we could treat the String type as if it were LocalDate using the following code:
import java.time.LocalDateimplicit def stringToLocalDate(s: String): LocalDate = LocalDate.parse(s)
Note that IntelliJ highlights a yellow warning Advanced language feature: implicit conversion on the implicit keyword.
If you want to get rid of this warning, you can position the cursor on the implicit keyword, then press Alt + Enter, and choose to Enable implicit conversion
Read now
Unlock full access