How to use implicit conversion, implicit parameters and implicit classes in Scala
This article mainly explains "how to use implicit conversion, implicit parameters and implicit classes in Scala". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and go deep into it slowly to study and learn "how to use implicit conversion, implicit parameters and implicit classes in Scala" together.
1. Generics in hands-on combat Scala
Generic classes and generic methods, that is, when we instantiate classes or call methods, we can specify their types. Since Scala's generics are consistent with Java's generics, we will not repeat them here.
2. Implicit transformations, implicit parameters, implicit classes in hands-on combat Scala
Implicit transformation is a difficult part of Scala for many people, and it's one of the quintessences of Scala:
Here is an example of hidden parameters:
The example above uses implicit parameters, but of course you can specify parameters explicitly:
Let's look at implicit classes:
Thank you for reading, the above is "Scala implicit conversion, implicit parameters, implicit class how to use" the content, after learning this article, I believe we have a deeper understanding of Scala implicit conversion, implicit parameters, implicit class how to use this problem, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!